chprintf STM32F4-Discovery with Expansion Board
Posted: Sun Aug 25, 2013 4:33 pm
Hi everyone. I am new to Chibios and Cortex programming, but I have a frustrating issue getting debugging working out of the Discovery expansion board's COM1 Serial output. If anyone isn't familiar with the expansion board, it is this -> http://www.st.com/web/catalog/tools/FM1 ... 2/PF255417
The expansion board comes with some software examples, and one is a USART example that contains a readme that states:
This example shows how to retarget the C library printf function to the USART.
This implementation output the printf message on the Hyperterminal using USART6.
Connect a null-modem female/female RS232 cable between the DB9 connector COM1 (USART6) and PC serial port
Therefore based on this, I have written this source code and tested with minicom and cutecom configured to 38400 baud with /dev/ttyUSB0 open and I get no output whatsoever from the board. I see in my ubuntu box through dmesg that the USB->Serial adapter I have connected to my computer is detected and connected to /dev/ttyUSB0 so I'm confident it isn't my box setup:
1941.427237] usb 2-2.3: New USB device found, idVendor=0557, idProduct=2008
[ 1941.427241] usb 2-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1941.427251] usb 2-2.3: Product: USB-Serial Controller D
[ 1941.427252] usb 2-2.3: Manufacturer: Prolific Technology Inc.
[ 1941.449659] pl2303 2-2.3:1.0: pl2303 converter detected
[ 1941.463221] usb 2-2.3: pl2303 converter now attached to ttyUSB0
Here is the code I am flashing to the board:
Here are my settings for UART and Serial in the config:
I hope someone can help me. I know that USART6 is connected to pins 6 and 7 on the board, and most of the examples for serial show additional configuration with pins 2 and 3, do I need to do anything extra to get TX and RX working for chprintf?
Thank you.
The expansion board comes with some software examples, and one is a USART example that contains a readme that states:
This example shows how to retarget the C library printf function to the USART.
This implementation output the printf message on the Hyperterminal using USART6.
Connect a null-modem female/female RS232 cable between the DB9 connector COM1 (USART6) and PC serial port
Therefore based on this, I have written this source code and tested with minicom and cutecom configured to 38400 baud with /dev/ttyUSB0 open and I get no output whatsoever from the board. I see in my ubuntu box through dmesg that the USB->Serial adapter I have connected to my computer is detected and connected to /dev/ttyUSB0 so I'm confident it isn't my box setup:
1941.427237] usb 2-2.3: New USB device found, idVendor=0557, idProduct=2008
[ 1941.427241] usb 2-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1941.427251] usb 2-2.3: Product: USB-Serial Controller D
[ 1941.427252] usb 2-2.3: Manufacturer: Prolific Technology Inc.
[ 1941.449659] pl2303 2-2.3:1.0: pl2303 converter detected
[ 1941.463221] usb 2-2.3: pl2303 converter now attached to ttyUSB0
Here is the code I am flashing to the board:
Code: Select all
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
#include <chstreams.h>
#include <string.h>
#include <stdio.h>
int main(void)
{
halInit();
chSysInit();
sdStart( &SD6 , NULL );
while(TRUE)
{
chprintf((BaseSequentialStream*)&SD6, "TEST");
chThdSleepMilliseconds(1000);
}
return 0;
}Here are my settings for UART and Serial in the config:
Code: Select all
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USE_USART6 TRUE
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USE_USART3 FALSE
#define STM32_UART_USE_USART6 FALSE
I hope someone can help me. I know that USART6 is connected to pins 6 and 7 on the board, and most of the examples for serial show additional configuration with pins 2 and 3, do I need to do anything extra to get TX and RX working for chprintf?
Thank you.