"STM32F205 initializing
This is a t"
It should have printed "This is a test". Changing a few lines will make it send more or less data. For example, removing the line feeds, makes it only print "STM32F205 initializin"
Code: Select all
int main(void)
{
const SerialConfig sc1_config =
{
19200, // baud rate
0, // CR1 register
0, // CR2 register
0 // CR3 register
};
halInit();
chSysInit();
sdStart(&SD1, &sc1_config);
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
chprintf((BaseSequentialStream *)&SD1, "\nSTM32F205 initializing\n\r");
chprintf((BaseSequentialStream *)&SD1, "This is a test\n\r");
chThdSleepMilliseconds(500);
Note, I added a huge sleep of 500ms to make sure there is plenty of time for the entire output queue to be sent. After the sleep I start a blinking LED thread and then an infinite while(1){} loop. I tried looking at the "flags" from chEvtGetAndClearFlags() based on the FAQ, but it returns 0 (no flags set).
I tried a quick loop using chSequentialStreamPut which works with no problems:
Code: Select all
int result;
int i;
const char tx_string1[] = "\nSTM32F205 initializing\n\r";
const char tx_string2[] = "This is a test\n\r";
i = 0;
do {
result = chSequentialStreamPut((BaseSequentialStream *)&SD1, tx_string1[i]);
} while (tx_string1[i++] != 0);
i = 0;
do {
result = chSequentialStreamPut((BaseSequentialStream *)&SD1, tx_string2[i]);
} while (tx_string2[i++] != 0);
Any suggestions? I don't have much knowledge about how each byte is sent out from the output queue to the UART.
Thanks in advance.