AnsweredAssumed Answered

STM32-MAT/TARGET. Tons Of Bugs: Partial declaration for the second and subsequent USART

Question asked by Dima Sagalov on Feb 26, 2018
Latest reply on Feb 26, 2018 by Dima Sagalov

Environment:

Windows10 (x64)

Matlab R2017a

STM32-MAT/TARGET-v4.4.2

STM32CubeMX-v4.24.0

STM32Cube MCU Package for STM32F0 Series -v1.9.0

STM32Cube MCU Package for STM32F3 Series -v1.9.0

SW4STM32-v2.4

TrueSTUDIO-v9.0.0

 

If you use only one of the UARTs (USART1, USART2, USART3, USART4, USART5), there is no problem!

If more than one USART interface is used (in our example we use everything from USART1 to USART5), the generator does not insert line in the file <project_name>_USART.c:

 

/* USART2 Receive data buffer index*/
uint16_t G_USART2_Rx_idx;
/* USART3 Receive data buffer index*/
uint16_t G_USART3_Rx_idx;
/* USART4 Receive data buffer index*/
uint16_t G_USART4_Rx_idx;
/* USART5 Receive data buffer index*/
uint16_t G_USART5_Rx_idx;

 

in the file <project_name>_USART.h

 

void USART2_CopyDataFcn (uint8_t*, uint16_t , struct USART_TxDataLinkTypeDef* );
void USART2_SendDataFcn (struct USART_TxDataLinkTypeDef* );
void USART3_CopyDataFcn (uint8_t*, uint16_t , struct USART_TxDataLinkTypeDef* );
void USART3_SendDataFcn (struct USART_TxDataLinkTypeDef* );
void USART4_CopyDataFcn (uint8_t*, uint16_t , struct USART_TxDataLinkTypeDef* );
void USART4_SendDataFcn (struct USART_TxDataLinkTypeDef* );
void USART5_CopyDataFcn (uint8_t*, uint16_t , struct USART_TxDataLinkTypeDef* );
void USART5_SendDataFcn (struct USART_TxDataLinkTypeDef* );

 

...

 

 

/* USART2 Receive data buffer index*/
extern uint16_t G_USART2_Rx_idx;
/* USART3 Receive data buffer index*/
extern uint16_t G_USART3_Rx_idx;
/* USART4 Receive data buffer index*/
extern uint16_t G_USART4_Rx_idx;
/* USART5 Receive data buffer index*/
extern uint16_t G_USART5_Rx_idx;

Outcomes