cancel
Showing results for 
Search instead for 
Did you mean: 

STM3220F-EVAL board serial driver example code

mike_trippi
Associate II
Posted on March 29, 2011 at 21:06

STM3220F-EVAL board serial driver example code

6 REPLIES 6
ams2
Associate II
Posted on May 17, 2011 at 14:30

Where did you get the STM3230F-EVAL board?

Posted on May 17, 2011 at 14:30

Can't be profoundly different from the STM32F1xx examples with IAR/Keil.

Why don't you post what you have, and we'll see if there anything obviously wrong with it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mike_trippi
Associate II
Posted on May 17, 2011 at 14:30

I can't post my driver because it is company IP but the USART is identical to the one on the STM32F1xx, but the GPIO setup is completely different.  So I'm looking for the GPIO settings.

Posted on May 17, 2011 at 14:30

I can't post my driver because it is company IP

And you want people here to share code with you, that's pretty rich.

Nobody is asking for you to post your application, just enough demo or harness code for review.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mike_trippi
Associate II
Posted on May 17, 2011 at 14:30

Turns out the board documentation was wrong and that USART4 is the correct one.  After making that change, serial now works.  This issue can be closed.

mike_trippi
Associate II
Posted on May 17, 2011 at 14:30

/* Enable Clock for GPIOC on AHB1 */

ENABLE_PERIPHERAL_CLOCK(AHB1, GPIOC);

/* Select Alternate function for USART3 pins */

//USART3_TX : MODER[21-20] PC10

//USART3_RX : MODER[23-22] PC11

temp = GPIO_READ(C, MODER);

temp &= 0xFF0FFFFF;

GPIO_WRITE(C, MODER, (temp | 0x00A00000));

/* Set output to max speed 50MHz */

temp = GPIO_READ(C, OSPEED);

temp &= 0xFFCFFFFF;

GPIO_WRITE(C, OSPEED, (temp | 0x00200000));

/* Set output to pull-up */

temp = GPIO_READ(C, PUPDR);

temp &= 0xFFCFFFFF;

GPIO_WRITE(C, PUPDR, (temp | 0x00100000));

/* Select Alternate Function 7 for USART3 pins */

//USART3_TX : AFRH[11:8] PC10

//USART3_RX : AFRH[15-12] PC11

temp = GPIO_READ(C, AFRH);

temp &= 0xFFFF00FF;

GPIO_WRITE(C, AFRH, (temp | 0x00007700));

/* Reset USART3 on APB1 */

RESET_PERIPHERAL(APB1, USART3);

/* Enable Clock for USART3 */

ENABLE_PERIPHERAL_CLOCK(APB1, USART3);