# J16 as DIN/DOUT (LPC1769)

**URL:** <https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081>\
**Category:** Testing/Troubleshooting\
**Tags:** j16-shift-register\
**Created:** [October 5, 2017, 2:41pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081 "2017-10-05T14:41:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 5, 2017, 2:41pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/1 "2017-10-05T14:41:04Z")

</div>

Hi,&nbsp;

How to transform J16 in a normally connected to the SRIO chain to scan DIN/DOUT modules?

What should I change to achieve this goal?

&nbsp;

TKS!!!

&nbsp;

Marco.

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 6, 2017, 3:57pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/2 "2017-10-06T15:57:33Z")

</div>

Hi,

you can switch to J16 with following define in your mios32\_config.h file:

```
#define MIOS32\_SRIO\_SPI 0

```

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 6, 2017, 5:23pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/3 "2017-10-06T17:23:14Z")

</div>

Hi TK thanks for the reply !!  
Can I use SPI0 (DIN / DOUT) and SPI1 (DIN / DOUT) simultaneously?

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 6, 2017, 7:48pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/4 "2017-10-06T19:48:14Z")

</div>

Unfortunately not - the SRIO driver is monolithic, it can only be assigned to a single SPI interface.

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 6, 2017, 10:47pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/5 "2017-10-06T22:47:25Z")

</div>

Tks TK.&nbsp;

I got sad ☹  
I used this function" MIOS32\_SPI\_TransferByte "&nbsp;…and&nbsp;&nbsp;&nbsp;I got some signal from the LEDs …

```
 MIOS32\_SPI\_Init(0); MIOS32\_SPI\_TransferModeInit(0,MIOS32\_SPI\_MODE\_CLK1\_PHASE1,MIOS32\_SPI\_PRESCALER\_128); MIOS32\_SPI\_IO\_Init(0,MIOS32\_SPI\_PIN\_DRIVER\_WEAK\_OD); MIOS32\_SPI\_RC\_PinSet(0,1,1);

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 6, 2017, 11:19pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/6 "2017-10-06T23:19:00Z")

</div>

Of course, you are free to service the SR register chain&nbsp;directly without using the SRIO driver (resp. implement a second SRIO driver)

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 7, 2017, 10:48pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/7 "2017-10-07T22:48:46Z")

</div>

Hi TK, do you have any examples in the forum that control SRs (j16) as the “MIOS32\_DOUT\_PinSet” function?

I tried to study this function, but I could not succeed.

&nbsp;

Thanks!!

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 8, 2017, 8:42pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/8 "2017-10-08T20:42:59Z")

</div>

AFAIK there is no forum posting about this so far.  
The shift registers are service from MIOS32\_SRIO, this code has to be duplicated (and button related functions have to be removed):&nbsp;[http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fmios32%2Fcommon%2Fmios32\_srio.c](http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fmios32%2Fcommon%2Fmios32_srio.c)

Btw.: why do you need the second SRIO chain? Wouldn’t it be easier to enhance the first chain by +16 SRs?

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 8, 2017, 10:45pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/9 "2017-10-08T22:45:42Z")

</div>

Hi,

I need it because of the DJ program (Traktor). each side of the deck has 16 RGB LEDs (96 outputs). Missing VUs, elapsed time, LEDs for the other buttons (RGBs). Unfortunately that consumes many outputs and I’m afraid the 256 outputs will not be enough. I just want to ensure having more options for digital inputs and outputs.

I’ll try it later, I program all day and my head can not think anymore.

Sorry for my bad english.

Thanks again !! Marco.

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 9, 2017, 7:03pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/10 "2017-10-09T19:03:41Z")

</div>

Hi,

you should consider to connect the RGB LEDs to a LED matrix, this is less expensive and also reduces the number of wires.

E.g. a 8x16x3 matrix consist of 7&nbsp;x 74HC595 and allows you to connect 128 RGB LEDs.

Then just add another 8x16x3 matrix for the second deck.

Do you know the MIDIbox NG application?  
It supports such features out-of-the-box:&nbsp;[http://www.ucapps.de/midibox\_ng.html](http://www.ucapps.de/midibox_ng.html)

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 10, 2017, 2:01am UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/11 "2017-10-10T02:01:26Z")

</div>

Hi Thorsten .

&nbsp;

I did not want to use matrix, but I think I have to use.&nbsp;

Can I configure the outputs of the 8x16 matrix using which function? BLM\_CHEAPO?

&nbsp;

Thanks!! Marco

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 10, 2017, 2:36pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/12 "2017-10-10T14:36:47Z")

</div>

Hi&nbsp;Thorsten,

I tried using MAKE to compile MIDIBOX\_NG and some errors appeared.

```
I:\MIOS32\trunk\apps\controllers\midibox\_ng\_v1\>make rm -f project.hex Creating object file for port.c i:/MIOS32/trunk/FreeRTOS/Source/portable/GCC/ARM\_CM3/port.c: In function 'prvPortStartFirstTask': i:/MIOS32/trunk/FreeRTOS/Source/portable/GCC/ARM\_CM3/port.c:282:1: warning: stack usage computation not supported for this target [enabled by default] Creating object file for core\_cm3.c i:/MIOS32/trunk/drivers/LPC17xx/CMSIS/src/core\_cm3.c: In function '\_\_get\_PSP': i:/MIOS32/trunk/drivers/LPC17xx/CMSIS/src/core\_cm3.c:451:1: warning: stack usage computation not supported for this target [enabled by default] Creating object file for usbcontrol.c i:/MIOS32/trunk/drivers/LPC17xx/usbstack/src/usbcontrol.c: In function 'StallControlPipe': i:/MIOS32/trunk/drivers/LPC17xx/usbstack/src/usbcontrol.c:127:6: warning: variable 'pb' set but not used [-Wunused-but-set-variable] Creating object file for psock.c i:/MIOS32/trunk/modules/uip/uip/psock.c: In function 'psock\_send': i:/MIOS32/trunk/modules/uip/uip/psock.c:179:3: warning: variable 'PT\_YIELD\_FLAG' set but not used [-Wunused-but-set-variable] i:/MIOS32/trunk/modules/uip/uip/psock.c: In function 'psock\_generator\_send': i:/MIOS32/trunk/modules/uip/uip/psock.c:218:3: warning: variable 'PT\_YIELD\_FLAG' set but not used [-Wunused-but-set-variable] i:/MIOS32/trunk/modules/uip/uip/psock.c: In function 'psock\_readto': i:/MIOS32/trunk/modules/uip/uip/psock.c:274:3: warning: variable 'PT\_YIELD\_FLAG' set but not used [-Wunused-but-set-variable] i:/MIOS32/trunk/modules/uip/uip/psock.c: In function 'psock\_readbuf': i:/MIOS32/trunk/modules/uip/uip/psock.c:301:3: warning: variable 'PT\_YIELD\_FLAG' set but not used [-Wunused-but-set-variable] Creating object file for ws2812.c i:/MIOS32/trunk/modules/ws2812/ws2812.c:71:2: warning: #warning "WS2812 driver not supported for this derivative yet!" [-Wcpp] i:/MIOS32/trunk/modules/ws2812/ws2812.c:102:12: warning: 'send\_buffer' defined but not used [-Wunused-variable] Creating object file for msc\_bot.c i:/MIOS32/trunk/modules/msd/LPC17xx/msc\_bot.c: In function 'MSCBotBulkOut': i:/MIOS32/trunk/modules/msd/LPC17xx/msc\_bot.c:268:13: warning: variable 'iChunk' set but not used [-Wunused-but-set-variable] Creating object file for msc\_scsi.c i:/MIOS32/trunk/modules/msd/LPC17xx/msc\_scsi.c: In function 'SCSIHandleCmd': i:/MIOS32/trunk/modules/msd/LPC17xx/msc\_scsi.c:155:14: warning: variable 'dwLBA' set but not used [-Wunused-but-set-variable] Creating object file for freertos\_heap.cpp c:/mios32\_toolchain/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: project\_build/project.elf section `.bss' will not fit in region `RAM' c:/mios32\_toolchain/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 672 bytes collect2.exe: error: ld returned 1 exit status make: \*\*\* [project\_build/project.elf] Error 1

```

Thanks, Marco.

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [October 10, 2017, 5:13pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/13 "2017-10-10T17:13:19Z")

</div>

It seems that your repository contains expired source files, this compile problem for LPC17 has been fixed some time ago.

Just update your subversion&nbsp;repository

Best Regards, Thorsten.

&nbsp;

---

<div class="post-metadata">

**Author:** ![Dj\_Marco\_BH](https://forum.midibox.org/user_avatar/forum.midibox.org/dj_marco_bh/32/611_2.png) [@Dj\_Marco\_BH](https://forum.midibox.org/u/Dj_Marco_BH)\
**Post date:** [October 10, 2017, 6:11pm UTC](https://forum.midibox.org/t/j16-as-din-dout-lpc1769/20081/14 "2017-10-10T18:11:00Z")

</div>

I updated today, and the problem continues…
