cancel
Showing results for 
Search instead for 
Did you mean: 

Problem receiving data from CC2540

tonyblake9
Associate II
Posted on July 13, 2017 at 18:28

Hi,

I have an STM32 and am trying to receive a single byte of data from a CC2540 over UART. I've verified that the data transmission from the CC2540 is working properly (I can receive the data in a serial terminal) but for some reason the data is not being received by the STM32. I am using USART3_IRQ on the STM32 and have verified that it is working properly (I can trigger USART3_IRQ by sending test data from a serial terminal).

Can anyone help me with this? It's very puzzling.

Cheers,

Tony

#uart #stm32 #cc2540
2 REPLIES 2
Posted on July 13, 2017 at 19:01

>>

Can anyone help me with this? It's very puzzling.

Even more so with no HW or SW to look at.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 17, 2017 at 16:04

I am using a custom pcb with an onboard STM32 and CC2540 physically connected together over USART3. I have programmed the CC2540 to relay a single byte of data over USART3 and programmed the STM32 to receive this data in USART3_IRQ. Here is the relevant code from each device:

1) CC2540 (BLE_Bridge):

   static void simpleProfileChangeCB( uint8 paramID )

   {

      uint8 data[20];

      uint8 len;

      switch( paramID )

      {

         case HORIZON_VALUE:

            SimpleProfile_GetParameter( HORIZON_VALUE, &data );

            len = data[0];

            //keep trying to send data until it is a success. this may not be the desirable approach

            while (sendDataToHost(&data[1], len));

            break;

         default:

         // do nothing

         break;

      }

}

2) STM32:

void USART3_IRQHandler(void)

{

   RXNE_flag = USART_GetFlagStatus(USART3, USART_IT_RXNE);

   RXNE_IT_status = USART_GetITStatus(USART3, USART_IT_RXNE);

   if(RXNE_IT_status != RESET){

      horizon_val = (s16) USART_ReceiveData(USART3);

   }

}

As I said, I can successfully send data to the STM32 through a serial terminal so USART3_IRQ should be triggered when the CC2540 transmits the data.

I have configured USART3 on the CC2540 to use DMA, do I have to use DMA on the STM32 as well?

Tony