Duggle Posted October 16, 2012 Report Share Posted October 16, 2012 I'd like to have 4 midi ports on my SEQV4L and have wired up the interfaces but I've hit a snag. MIDI IN/OUT4 is straight forward as J4B.SC and J4B.SD are unused in the SEQV4L. MIDI IN/OUT3 However, requires J5B.A6 and J5B.A7 which are currently used to drive LED matrix columns. It looks like it should be straight forward to use 2*I/O lines from either J8/9 or J19 for the last two LED column drivers and free up the MIDI IN/OUT3 pins. I'm having trouble finding my way around the source and would really appreciate some hints. Thanks! Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 16, 2012 Author Report Share Posted October 16, 2012 O.K, I think I've tracked down to where the column drivers are written: ///////////////////////////////////////////////////////////////////////////// //! This function services the row selection lines at J15 and the //! LED output lines at J5A/B //! It should be called from the APP_SRIO_ServicePrepare() //! \return < 0 on errors ///////////////////////////////////////////////////////////////////////////// s32 BLM_CHEAPO_PrepareCol(void) { if( ++selected_row >= 8 ) selected_row = 0; // selection lines at J15 u8 selection_mask = (1 << selected_row); MIOS32_BOARD_J15_DataSet(selection_mask); // LED columns at J5A/B MIOS32_BOARD_J5_Set(led_row[selected_row]); return 0; // no error } So it would appear that if I copy the bit states of bits 6 and 7 of led_row[selected_row] to the new I/O lines from say J19 then it will work as I need. Does selecting UART functionality mean that bits 6,7 of J5 are no longer affected by MIOS32_BOARD_J5_Set(led_row[selected_row]) ? Actually, J28 is free and also supported by the mios32_board.c functions so I'll try this. Quote Link to comment Share on other sites More sharing options...
TK. Posted October 17, 2012 Report Share Posted October 17, 2012 I guess that you've to skip the initialisation of these pins in BLM_CHEAPO_Init: // initialize all pins of J5A and J5B as outputs in Push-Pull Mode for(pin=0; pin<8; ++pin) MIOS32_BOARD_J5_PinInit(pin, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); [/code] changed to: [code] // initialize all pins of J5A and J5B as outputs in Push-Pull Mode for(pin=0; pin<6; ++pin) MIOS32_BOARD_J5_PinInit(pin, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); No modification is required when calling MIOS32_BOARD_J5_Set in this case, since A6/A7 are configured for alternate mode (and not GPIO mode), and therefore won't be overwritten. Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 18, 2012 Author Report Share Posted October 18, 2012 I've chosen J28.0 and J28.1 to drive the columns that were driven by J15.6 and J15.7 // LED columns at J5A/B MIOS32_BOARD_J5_Set(led_row[selected_row]); //***dug***bits 6 and 7 are not initialised for GPIO so have no effect MIOS32_BOARD_J28_Set(led_row[selected_row]>>6);//put 6,7 into 0,1 Is working but there is another (unused) peripheral accessing J28 when the sequencer is running causing an additional flicker to two of the led columns. It turns out there are calls involving J28 in seq_cv.c How do I disable the other function (Aout, I think) from the app build? PS: at the moment to make the affected led matrix columns work (at all) I call MIOS32_BOARD_J28_PinInit(0, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); MIOS32_BOARD_J28_PinInit(1, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); every time in BLM_CHEAPO_PrepareCol(). Quote Link to comment Share on other sites More sharing options...
TK. Posted October 18, 2012 Report Share Posted October 18, 2012 You would have to add #ifdef... switches, and set the switch in your mios32_config.h file Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 18, 2012 Author Report Share Posted October 18, 2012 What call(s) should I switch out with an #ifdef? Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 19, 2012 Author Report Share Posted October 19, 2012 (edited) I've now got the LEDs working correctly by switching out any code with MIOS32_BOARD_J28_PinInit() or MIOS32_BOARD_J28_PinSet() involving pin 0, or 1. I'll provide the details when all the midi ports are working. If I now include #define MIOS32_UART_NUM 4 in mios32_config.h I get the following build error: c:/mios32_toolchain/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe: project_build/project.elf section `.bss_ahb' will not fit in region `RAMAHB' c:/mios32_toolchain/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe: region `RAMAHB' overflowed by 40 bytes collect2: ld returned 1 exit status make: *** [project_build/project.elf] Error 1 Any suggestion on how to resolve this? Thanks. (edit) I can now confirm that with #define MIOS32_UART_NUM 3 I'm not getting the build error and MIDI Port 3 is working! Edited October 19, 2012 by Duggle Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 20, 2012 Author Report Share Posted October 20, 2012 My "quick fix" for the build problem when #define MIOS32_UART_NUM 4 was to reduce the heap by 1k: #define MIOS32_HEAP_SIZE 14*1024 change to #define MIOS32_HEAP_SIZE 13*1024 Will (might) this cause run time problems? Thanks Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 20, 2012 Author Report Share Posted October 20, 2012 When the sequencer is running I'm getting can't allocate 342 blocks at 835 repeatedly printed on the debug console. I suppose there is a better way to save 40 bytes in the upper ram? Quote Link to comment Share on other sites More sharing options...
TK. Posted October 21, 2012 Report Share Posted October 21, 2012 Typical trouble with the splitted RAM... :-( However, we had luck: in osc_server.c I found an array which was located in RAM, but actually is constant (the search tree) It's now located in flash, and 1k AHB RAM is free for other purposes :) Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Duggle Posted October 21, 2012 Author Report Share Posted October 21, 2012 Works great, Thank you so much Thorsten! There is a warning generated which I haven't looked into yet but here is: Creating object file for osc_server.c w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c: In function 'OSC_SE RVER_AppCall': w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:273:7: warning: pass ing argument 3 of 'MIOS32_OSC_ParsePacket' discards qualifiers from pointer targ et type w:/sw/tempmios/trunk/include/mios32/mios32_osc.h:106:12: note: expected 'struct mios32_osc_search_tree_t *' but argument is of type 'const struct mios32_osc_sea rch_tree_t *' w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c: At top level: w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:765:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:766:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:767:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:768:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:769:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:770:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:801:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:803:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:804:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:805:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:806:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:807:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:808:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:809:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:810:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:811:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:812:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:813:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:814:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:815:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:816:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:817:3: warning: init ialization discards qualifiers from pointer target type w:/sw/tempmios/trunk/modules/uip_task_standard/osc_server.c:818:3: warning: init ialization discards qualifiers from pointer target type Quote Link to comment Share on other sites More sharing options...
TK. Posted October 21, 2012 Report Share Posted October 21, 2012 Your include/mios32/mios32_osc.h file isn't up-to-date -> please update the complete repository. If you want to find out the exact changes, just use the compare function of the svn webviewer: http://svnmios.midibox.org/comp.php?repname=svn.mios32&compare%5B%5D=%2F%401524&compare%5B%5D=%2F%401523 It usually helps to understand the required modifications (ignore the change in MBKB...) Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Duggle Posted December 15, 2012 Author Report Share Posted December 15, 2012 The mod works brilliantly! I've documented the hardware and software changes in this blog article: If anything is unclear let me know! Quote Link to comment Share on other sites More sharing options...
TK. Posted December 15, 2012 Report Share Posted December 15, 2012 Very nice! :) Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.