cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F072RBT6

ilias
Associate II
Posted on August 24, 2015 at 11:15

Hello,

Can anybody help in order to setup the USART1 on this controller? I have a ST NUCLEO dev. board with this Microcontroller. I don't want to use the Cube generator. I want to use the stdperiph driver without hal abstraction. Can anyone help me for the stperiph driver firmware package I have to use and how to set the USART1?

Thanks in advance.

#usart1 #stm32f072rbt6
6 REPLIES 6
Amel NASRI
ST Employee
Posted on August 24, 2015 at 12:27

Hi karakiritsis.ilias,

For STM32F0, you have 3 firmware solutions:

  1. the Standard Peripheral Library (

    http://www.st.com/web/en/catalog/tools/PF257884#

    ), there are examples under: STM32F0xx_StdPeriph_Lib_V1.5.0\Projects\STM32F0xx_StdPeriph_Examples\USART
  2. the

    http://www.st.com/web/en/catalog/tools/PF260612

     package
  3. the 

    http://www.st.com/web/en/catalog/tools/PF260157

    package, there are snippet examples under STM32F0xx_Snippets_Package_V1.2.0\Projects\USART
You can select the suitable one depending on your needs.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on August 24, 2015 at 14:06

There are also code examples at the end of the RM.

JW
Posted on August 24, 2015 at 16:50

F0 DISCO and NUCLEO stuff for the F0 in [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/UART%20example%20code%20for%20STM32F0&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=30079]this thread

If your question seems like it might have been asked before, it probably has, please search the forum..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ilias
Associate II
Posted on September 04, 2015 at 13:29

Thank you all for your valuable help! I really appreciate it.

I have managed to port the code to STM32F072RBT6 using the stdperiph driver way.

Now I am dealing with another problem.

I am using the Eval-ST95HF board where I developed my initial code for my application. In this code following the driver of ST95HF I am able to initiate the chip by sending a sequence of commands. For example:

Reset: 0x01

Echo; 0x55

etc...

I am able to verify that I am sending the right commands by using an oscilloscope to check the signals.

The Problem:

 

I have a custom board with STM32F072RBT6 MCU and an ST95HF RF chip. My intention is to have an identical RF operation (that is the reason I had to migrate the code to the new MCU).

I have configured the SPI interface identical to the SPI interface of the Eval-ST95HF board.

However, the signals on the oscilloscope for my board are quite different comparing to signals on Eval board.

Example1:

Eval(STM32F103RGT6): sending 0x55. --> Osciloscope ->

0x55

My board(STM32F072RBT6): sending 0x55. --> Osciloscope ->

0x5500

Example2:

Eval(STM32F103RGT6): sending 0x01. --> Osciloscope ->

0x01

My board(STM32F072RBT6):  sending 0x01. --> Osciloscope ->

0x0100

Example3:

Eval(STM32F103RGT6): sending 0x00. --> Osciloscope ->

0x00

My board(STM32F072RBT6):  sending 0x00. --> Osciloscope ->

0x0000

 

Just to mention that the SPI configuration is identical (by checking the Registers CR1, CR2 and SR)

Thanks in advance.

Posted on September 07, 2015 at 07:02

You have to write to SPI->DR as a byte, as writing it as a halfword writes one byte to the transmitting register and one byte to the FIFO.

The SPI in 'F0x differs in FIFO from the 'F1x SPI.

JW

ilias
Associate II
Posted on September 07, 2015 at 14:48

Thanks for your reply. It was really helpful.

Indeed I had to use a 8bit sender function for SPI transmit. I was using a 16 bit transmit function by casting the data and it didn't work.

Another important configuration to make it work was to modify fifo reception threshold to  8 bits by using this command:

 SPI_RxFIFOThresholdConfig (SPIx, SPI_RxFIFOThreshold_QF);

And it worked!

Thanks again!