[STM32F070] Have USART4 but not in ChibiOS?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
ADI-mistrzu
Posts: 12
Joined: Mon Jun 29, 2015 8:37 am

[STM32F070] Have USART4 but not in ChibiOS?

Post by ADI-mistrzu »

Hi,

I would like use USART4 interface in my project, but how I see, actual hal not support that?
In technical description (http://www.st.com/web/en/resource/techn ... 141386.pdf) on page 10 we have that STM32F070CB and STM32F070RB have 4 USART.

So what in this situation, I shoud run USART4 via direct control registry or maybe exist some other hal port for STM32F0 with this USART?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [STM32F070] Have USART4 but not in ChibiOS?

Post by Giovanni »

Hi,

I committed some changes 1 hour ago, now the USART 3..6 should be supported. You need to add the related settings to your mcuconf.h.

Giovanni
User avatar
ADI-mistrzu
Posts: 12
Joined: Mon Jun 29, 2015 8:37 am

Re: [STM32F070] Have USART4 but not in ChibiOS?

Post by ADI-mistrzu »

OK, but now there you have uart4, it should be uSart4, so when you try use that, compiller can't find registry UART4.
I see you have conflict with another STM peripheral.

More over, STM32F070 have USB, so in stm32_registry.h in line 1521 should be

Code: Select all

#define STM32_HAS_USB                       TRUE
#define STM32_USB_ACCESS_SCHEME_2x16        TRUE
#define STM32_USB_PMA_SIZE                  768
#define STM32_USB_HAS_BCDR                  TRUE


In ext_lld_isr.c in line 227 and 244 I change:

Code: Select all

#if !defined(STM32F030)

to

Code: Select all

#if !defined(STM32F030) && !defined(STM32F070xB)


In serial_lld.h line 215:

Code: Select all

#if !STM32_SERIAL_USE_USART1 && !STM32_SERIAL_USE_USART2 &&                 \
    !STM32_SERIAL_USE_USART3 && !STM32_SERIAL_USE_UART4  &&                 \
   !STM32_SERIAL_USE_USART4 && !STM32_SERIAL_USE_UART5  &&                 \
   !STM32_SERIAL_USE_USART6 && !STM32_SERIAL_USE_UART7  &&                 \
   !STM32_SERIAL_USE_UART8
#error "SERIAL driver activated but no USART/UART peripheral assigned"
#endif
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [STM32F070] Have USART4 but not in ChibiOS?

Post by Giovanni »

Hi,

It is UART4 not USART4 because the serial driver is shared with all the other STM32s where 4,5,7,8 are UARTs not USARTs. Changing that name would not change how the peripheral is used so it is not an issue.

Fixed the other things.

Giovanni
User avatar
ADI-mistrzu
Posts: 12
Joined: Mon Jun 29, 2015 8:37 am

Re: [STM32F070] Have USART4 but not in ChibiOS?

Post by ADI-mistrzu »

Are you sure?

For example there (STM32F070):
http://www.st.com/web/en/resource/techn ... 141386.pdf
In all place we have USART4, not UART4.

But in:
http://www.st.com/st-web-ui/static/acti ... 191185.pdf
You have in all place UART4.

More over in stm32f070xb.h registry is named USART4, not UART4.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [STM32F070] Have USART4 but not in ChibiOS?

Post by Giovanni »

I was talking about the serial driver itself, not the ST code.

Those differences in names are really a problem, I need to add another workaround.

Giovanni
Post Reply