I have a project where I need to do serial communication all of a sudden.
I enabled the serial driver (actually it already was), and issue the "sdStart ()" call. Then when I write to the port, I get only 16 characters...
Code: Select all
This is a test
Hello on the seria
The odd thing is that after the first precisely 16 char print, things still continue to work, but with only the second print, it stops at precisely 16/27 chars. [edit: I miscounted: 18 chars are printed. ]
The code to print:
Code: Select all
sdWrite (&SD2, (uint8_t *) "This is a test\r\n", 16);
// chprintf ((BaseSequentialStream *)&SD2, "Hello on the serial line.\r\n");
sdWrite (&SD2, (uint8_t *) "Hello on the serial line.\r\n", 27);
Did I misconfigure the IRQ? I don't see a configure-the-irq in mcuconf.h . It's not using DMA. So what else could be the cause?
Code: Select all
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 TRUE
#define STM32_SERIAL_USE_USART2 TRUE
#define STM32_SERIAL_USART1_PRIORITY 3
#define STM32_SERIAL_USART2_PRIORITY 3
Edit: Solution:
Another part of the code was stealing the SD driver from me. the 16 characters was hinting at the buffer overflowing. But when I removed the first "this is a test" print, that too got chopped! I then added a delay and suddenly everything was printed. Now I could move the delay around to look for the code that was interfering with my new SD code....