Prompt please, how correctly to work with UART buffers?


Hello :slight_smile: !
Help me please, to solve my problem…

I use :
bool UART_Data_Handler (u16 FcmDataLen, u8 * FcmData)
bool Ret;
u16 i;

char msg [ 50 ] ;

if ( my conditions )

Ret = TRUE;
Ret = FALSE;

wm_sprintf ( msg, "\r\nHandlerPointer= %p \r\n", FcmData );
adl_fcmSendData(fcm_SubscribeResponse, msg, (u16)wm_strlen(msg ) );
wm_sprintf ( msg, "\r\nHandlerDataLen= %d \r\n", FcmDataLen );
adl_fcmSendData(fcm_SubscribeResponse, msg, (u16)wm_strlen( msg ) );


After Ret = FALSE; i out in giperterminal HandlerPointer(This is Data Pointer) and HandlerDataLen( This is Data Lenght)

Results :

HandlerPointer= 0101d8b0

HandlerDataLen= 112

HandlerPointer= 01019b20

HandlerDataLen= 16

HandlerPointer= 0101d8b0

HandlerDataLen= 124

HandlerPointer= 0101d954

HandlerDataLen= 81

HandlerPointer= 0101d954

HandlerDataLen= 124

HandlerPointer= 0101d8b0

HandlerDataLen= 76


Why HandlerPointer’s have alike dinamic address and different lenght???
I need, after CTS = 0 (NO Receive data ), read data from Uart byffers,
I know, what 6 buffers and use function adl_fcmReleaseCredits , can release buffer…

Prompt please, how correctly to work with UART buffers ???


Why ever not?! :open_mouth:

This is perfectly normal behaviour, and nothing at all to worry about! 8)

The handler is simply saying to you, “here are x bytes of data, starting at address y - your handler just needs to read (copy) that data into its own buffer, and process that as required.#

The actual value of the pointer is of no concern to you.