Author Topic: Strange UART issues with STM32F446  (Read 1626 times)

0 Members and 1 Guest are viewing this topic.

Offline BoscoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 276
Strange UART issues with STM32F446
« on: May 28, 2016, 10:06:10 am »
This is a strange one for me - never had any issues with this setup before.

I've got an STM32F446 on a board attached directly to an FT230X com port. I loaded some previously tested code to loop back the UART data one byte at a time however it didn't work. I can program via the bootloader 100% successfully so I know the hardware is okay. The problem is i only get data back on the com port console when the micro baud is set at 9600 and the console to 115200 and then only some characters are correct!

I was thinking this could be a hardware issue but it isn't, I have physical pull ups and I've tried taking them out and just using the internal pull ups - nothing. Looking at the signals on the scope they look fine with the same frequency oddly. 'y' works and sends back the correct 'y' however most other characters return a white block the signal on the scope isn't correct either.

I think this could be a internal clock issue but I've gone over it and can't find any errors. I've used STM32CubeMX to generate the base code.

Any suggestions would be appreciated.
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1719
  • Country: se
Re: Strange UART issues with STM32F446
« Reply #1 on: May 28, 2016, 10:29:32 am »
First of all, check the USB-UART adapter in loop back, just to better isolate the problem.
I don't know if there are fake FT230 around, might that be the case (knowing past history of "picky" FTDI drivers)?

There should be no need for pull-ups, if I read correctly the FT230 blurb (just regular inputs and outputs), but I don't think they cause any harm (at slow baud rates, at least).

Are you using interrupts, DMA or plain blocking calls?

Are you are using the HAL, or just the init code from CubeMX?

Is the MCU correctly clocked? Try toggling a pin at, say, 1kHz (using a timer or Systick) and check it on the scope for the correct frequency.

Is the MCU receiving correctly? You could try toggling a LED/pin when a specific character sequence is received.

Is the MCU sending correctly? You could try repeatedly sending a string to the PC.


Without seeing the code (and maybe the HW) there's not much more that can be said.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline BoscoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 276
Re: Strange UART issues with STM32F446
« Reply #2 on: May 28, 2016, 04:05:45 pm »
Hi thanks for your reply!

I've worked out what it is to the extent of internal clocks. The MCU was transmitting at nearly 3MHz for 115200 baud which was why it wasn't being received and 9600 baud kind of worked. For a bodge in the mean time I've set the MCU and to 5236 which corresponds to an actual baud of 115200. At the moment I just need to get some quick results out of this to get something else working - I may look into it more if I have time later. I did have a quick look at the clock setup and it looks correct.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf