cancel
Showing results for 
Search instead for 
Did you mean: 

BUG in USART Rx and Tx independently : STM32-MAT-TARGET.

lli.16
Associate

Hello!

I'm experiencing difficulties using STM32-MAT-TARGET to generate code for STM32 controllers from Simulink models using the provided blocks for USART communication.

STM32-MAT-TARGET : 4.4.2

Matlab 2017b

MDK-ARM Professional Version : 5.14

MCU : STM32F103VET6

I want send the received data by Keypress Exti Response without enable USART_Receive Block 's Software Interrupt. In other words, I want to control the send timing instead of sending the received data almost simultaneously. Please my module following .

BUG: NbRcv will be set zero before being passed to USART_send model' Nb2Send ,This will result in the inability to send data.

Code interpretation:

1.NbRcv always be set to zero before the Exti-button is pressed;

2.NbRcv value assignment to Data Store Write Block;

3.Value of Data Store Read Block assignment to Nb2Send;

4.Wait for end of current send data . if Nb2Send is not 0, if condition is true, USART_Send function will be execute , but the contion will always be false, the USART_Send function will always not be execute.

0690X000008AQRDQA4.png

1 REPLY 1
Cyril FENARD
ST Employee

​Hi @Community member​ ,

The data store memory is shared between the step() context and the asynchronous interrupt to trigger TX send operation.

This interrupt is raised at any time by the end-user, and can break the validity of a character possibly received:

- if this occurs before the end of the step, the data is valid since receipt of a new one is not started

- if this occurs at the beginning of the step, receipt of a new step begins, no data is valid at this time

For instance, with a the Fixed-step value of the fundamental step is set at 1 or 2 seconds, a previous received character can be sent (since it is valid before end of the current period of the step).

To make it simple, the sampling frequency of the character reception is too high per end-user action to display one of this chars.

Nothing can be displayed because it changes too fast.

Hoping it give details about what happens.

Regards

Cyril