cancel
Showing results for 
Search instead for 
Did you mean: 

F030 UART framing error

Stanislav Husár
Associate II
Posted on May 31, 2018 at 09:29

Hello,

I am trying to receive data from 

https://learn.adafruit.com/adafruit-ultimate-gps?view=all

, it should output 9600bd. MCU is STM32F030K6T6. Rx/Tx are crossed as they should be, connected to USART1 (PA2/PA3). I am not using any kind of HAL, just direct register access.

HCLK is HSE (8MHz crystal, 18pF capacitors). I am not using PLL.

I have tried multiple values for USART1->BRR:

  • 8 000 000 / 9600
  • 9600
  • 0x0341

Nothing works. Anything I have tried resulted in framing error.

LEDBlink.c is my code. system_stm32f0xx.c is from project template(I am using VisualGDB).

Can someone explain me what should be in BRR? Or where I could have mistake?

Thanks in advance,

Stanislav

EDIT: With these settings, I was previously able to receive data from the GPS using another brand of MCU.

#stm32f0 #uart
6 REPLIES 6
Posted on May 31, 2018 at 10:13

Ahoj,

Disable the autobaud first. You also might want to transmit a byte and check by an oscilloscope/LA whether its baudrate is set as you've expected.

Read back the USART's registers (in debugger), to check, whether they contain what you've written into them. You might need some delay between enabling its clock and writing into its registers.

JW

Stanislav Husár
Associate II
Posted on May 31, 2018 at 10:28

waclawek.jan, thank you for reply. All registers have their values.

I have found mistake at other place. As I am new to these MCUs(actually first project), I have been following a guide. Too much. While I thought I had pins configured as alternative function, they were actually configured as analog pins.

Now I do not have framing error, now it is ORE.

How to tell USART module I don't care? Actually, I do need a full NMEA, but I do not necessarily need all of them.

Thanks in advance,

Stanislav

Stanislav Husár
Associate II
Posted on May 31, 2018 at 10:49

I have tried simply removing ORE flag from the if statement, and loading data into string anyway. I have got full NMEA twice in a row.

So I think that it will be enough to clear ORE right before capturing start of NMEA.

Thank you for your replies. I'll let you know how it went, when I'll have full program written.

Stanislav Husár
Associate II
Posted on May 31, 2018 at 11:36

Interesting. I can always catch first NMEA after MCU boot.

With each request to capture start of NMEA sentence, I clear ORE.

Anyway, after first success, I get ORE.

Any idea why this behavior? New code in first post in this thread(Archív.zip).

Posted on May 31, 2018 at 10:42

USARTx_CR3.OVRDIS ?

But I don't think it's a good idea to ignore it.

JW

Posted on May 31, 2018 at 10:49

Hi

maskrtnik01

,

An overrun error occurs when a character is received when RXNE has not been reset,it mean that other byte of data arrives even before the previous byte has not been treated by CPU.

Are you usingthe polling mode ? if yes we expect that the USART data reading, made by polling, was interrupted by an interrupt (systick as example), could you please try to disable all interrupt and tel us if the issue still occurs.Anoverrun occurs only if the data is not received in time.

-Nesrine-