Skip to main content
Dima Sagalov
Associate II
February 26, 2018
Question

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

  • February 26, 2018
  • 3 replies
  • 1177 views
Posted on February 26, 2018 at 04:14

Environment:

Windows10 (x64)

Matlab R2017a

STM32-MAT/TARGET-v4.4.2

STM32CubeMX-v4.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;
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

#simulink #stm32-mat/target-matlab
This topic has been closed for replies.

3 replies

Andrew Neil
Super User
February 26, 2018
Posted on February 26, 2018 at 12:52

the generator

What 'generator' ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Dima Sagalov
Associate II
February 26, 2018
Posted on February 26, 2018 at 13:35

STM32-MAT/TARGET

Andrew Neil
Super User
February 26, 2018
Posted on February 26, 2018 at 13:45

So is that an ST thing, or a Matlab thing?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Dima Sagalov
Associate II
February 26, 2018