cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769I DISCOVERY problem in debugging using uart

soumaya BEN MANSOUR
Associate II
Posted on April 26, 2017 at 18:08

Hi community,

I'm using stm32f769i discovery, I communicate with Vacuum Transducer via the uart protocol.

Once I receive the whole data send by  the vacuum Transducer  to the stm ( @253ACK9.00E+2FF ) and that I stocked in a reception buffer ,I use a variable pression to write just the bit(7,12,13) who refer to the pression value. and then print the pression.

In the debug mode my code execute only the two lignes of (transmission and reception), so I can't get the pression value and even I can't get the data stocked in buffrec, it 's as if I lose the data in buffrec. If I remove all lines after 

HAL_UART_Receive_IT(&UartHandle, buffrec , 17) I can find data in buffrec.

Here is my code:

uint8_t bufftr[30] = '@253PR1?;FF';

uint8_t buffrec[17];

double pression;

while (1)

/*Transmitting and receiving data */

{

HAL_UART_Transmit_IT(&UartHandle, bufftr, 30);

HAL_UART_Receive_IT(&UartHandle, buffrec , 17); //buffrec[17]=

@253ACK9.00E+2FF;

if(inputBuffer2[12] == 43)

{

pression = (inputBuffer2[7]-48)*pow(10,(inputBuffer2[13]-48));

}

if(inputBuffer2[12] == 45) {

pression = (inputBuffer2[7]-48)*pow(10,-(inputBuffer2[13]-48));

}

printf('%lf%,pression);

}

Can anyone help me to know what I'm missing?

thanks in advance

2 REPLIES 2
Posted on April 26, 2017 at 18:58

Where does 

inputBuffer2 get filled/defined? Do you need to be waiting for a call-back before proceeding?

I'd probably do more to syntax check and ensure the line synchronization was correct.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
Posted on April 26, 2017 at 19:39

The description of what the SW does is not clear enough.

When interrupt mode is used, it's probably non-blocking... the SW continues while the RS232 is not yet receiving the first char, unless being very slow such as debugging in step by step mode.

As Clive said, a background task will run to collect incoming chars. How to know the string is complete? fixed length? termination character? How to make sure the buffer start filling up? With a header byte to 'synchronize'?

Also, once the right string is received, the callback can disable the interrupt, in case more is coming and possibly overflowing the incoming buffer.