cancel
Showing results for 
Search instead for 
Did you mean: 

USART_SendData adding bits

go_bare_foot
Associate
Posted on July 17, 2013 at 11:42

Hey I'm running the STM32L1 chip with an XBEE unit and everything works perfectly except my Tx adds bits when there is an even number in the unsigned char (I typedef this as BYTE) being sent. Shows in Putty and X-CTU.

My code is:

void init_pkg( DWORD val, __IO BYTE* buff )

{

for ( int x = 0, len = TX_BUFF_SIZE - 1; x < len; x++ )

    {

        *buff++ = val + x;

    } 

    

    *buff++ = MSG_END_CHAR;

}

void xbee_IRQHandler( void )

{

// -- Send buffer EMPTY interrupt -- //    

    if ( (USART_GetITStatus( XBEE_USART, USART_IT_TXE )) != RESET )

    {

       delay( XBEE_SEND_TMOUT );  

        USART_SendData( XBEE_USART, (TxBuffer[ TxCounter ] & 0x7F) );

        

         if ( (++TxCounter) == TxBufferSize )                            

        {

            USART_ITConfig( XBEE_USART, USART_IT_TXE, DISABLE );        

        }

        

    }

}

Is there something i'm missing? I've checked the whole ASCII table and always adds a MSB when there's an even number of bits set.

Any help would be great as I'm lost.

Cheers

#discovery #stm32l #example-usart #xbee
2 REPLIES 2
go_bare_foot
Associate
Posted on July 17, 2013 at 12:41

Sorry just found it, I'd got the parity bit setting wrong in the client side.

sanjib
Associate III
Posted on March 16, 2015 at 11:58

Hi

Can anybody say me how to configure for USARt half duplex in stm32l15cb  . I have configured as I configured for stm32f030(working USART half duplex) but it did not work what are the changes between stm32f030 and stm32l15cb