Serial on STM32F4 (beginner)

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
blundar
Posts: 5
Joined: Tue Jan 03, 2012 3:56 am

Serial on STM32F4 (beginner)

Post by blundar »

I'm using the STM32F4DISCOVERY board. I'm using Chibios 2.4.1 downloaded from sourceforge yesterday. I'm using YAGARTO dated June16-2012 with GCC 4.7.1

I've successfully built two projects that are supposed to make use of serial on the STM32F4 but neither are apparently working. (demos/ARMCM3STM32F4DISCOVERY and testhal/STM32F4xx/UART) Both projects claim to initialize and make use of serial port 2, PA2 and PA3.

I'm using an FTDI FT232RL based USB-> serial converter with software set to 38400 8N1. When I short the TX and RX lines, I get echoback on the PC. I've tried reversing the RX/TX lines. I've even tried putting a 2 channel scope on both lines. I'm reasonably certain it's not a hardware issue.

I'm seeing NOTHING on these lines with the scope or with the USB->TTL converter.

I have verified that my build and programming stuff is working correctly by decreasing the blink period of the orange LED from 500ms to 250ms so it now flashes twice as fast as the others. I get nothing at all with the testhal code. I get the blinkenlights with the demo code, but nothing when I press the user button.

So... I recompiled the demo application and changed it's function so that the orange LED lights up when you press the button and I can control the orange LED with the button. I wanted to make sure that the code to run the TestThread and output it over serial is running. I got a very interesting result. With the following code (in while(1) loop in main()) I can control the orange LED:

Code: Select all

    if (palReadPad(GPIOA, GPIOA_BUTTON))   {
           palSetPad(GPIOD, GPIOD_LED3);       /* Orange.  */
         chThdSleepMilliseconds(250);   
       }


but with this code:

Code: Select all

    if (palReadPad(GPIOA, GPIOA_BUTTON))   {
           TestThread(&SD2);
           palSetPad(GPIOD, GPIOD_LED3);       /* Orange.  */
         chThdSleepMilliseconds(250);   
       }

I cannot control the LED.

I'm really confused about what's going on.
In summary:
-The periodic LIS302 measurements are not coming out the serial port
-The Test results are not coming out the serial port when I push the user button
-The user button reading appears to work correctly when the Test suite is NOT executed, as is evidenced by being able to control the orange LED with the user button.

Anyone have any ideas on what I might be doing wrong here?
Thanks in advance.



Any tips/suggestions?
blundar
Posts: 5
Joined: Tue Jan 03, 2012 3:56 am

Re: Serial on STM32F4 (beginner)

Post by blundar »

So I think I figured this one out on my own.... really bizarre.

Ended up changing to a new USBA->MiniUSB cable to power the dev board and everything started working. Only thing I can figure is that the last cable was marginal and the device was starved for power.

Sorry for wasting bandwidth.
Post Reply