cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with USART2 Rx Callback with BLE_p2pServer_ota example

ledi7
Associate III

Hi,

i am using the BLE_p2pServer_ota example with NUCLEOWBA55 and i want transmitt a 20 Byte package over USART2 with DMA in circular mode (19200 Baud). Here as an example, i send 20 bytes every second via HTerm to USART2. BLE advertising (every 2s) is working (but i am not connected to the cellphone app). 

The Rx Callback function is inside p2p_server_app.c and here i want to toggle the blue LED:

/* USER CODE BEGIN FD_LOCAL_FUNCTIONS*/
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
   if(huart->Instance == USART2)	// Rx Callback for USART2
   {
	BSP_LED_Toggle(LED_BLUE);
   }
/* USER CODE END FD_LOCAL_FUNCTIONS*/

But after several transmissions (between 50 and 150) the callback function is no longer called.

Does anyone have an idea what is going wrong?

23 REPLIES 23

I'm not clear what that scope trace is supposed to be showing?

The scope image shows a strong jitter. Here at 115200 baud the jitter is not as strong, but still present.

SCR03.PNG

What do you mean by "jitter"?

You won't get a steady scope display unless the data being sent is constant!

So either:

  • Use a single-shot trigger, or
  • Send data that is constant; eg, a continuous stream of uppercase 'U'

Yes, the measurement method is probably not optimal. It looks better with a single shot, but when I measure the oscilloscope image precisely, I counted the number of bits in it from your trigger point (-500ns) to 399.5 µs.
I counted 46 bits in 400 µs, which gives 8.69565217... µs/bit, which is exactly 115000 baud and not 115200!
115200 baud would correspond to a length of 399.3 µs for 46 bits, so the edge change in the last bit should come a little BEFORE the raster line, but in the image it is more after it. 

All in all, this corresponds to a deviation of 0.17% and I don't think it should be a problem.

SCR05.PNG

Here i used the Protocoll measurement method with 19200 baud and PCLK2 as clock source for USART1:

SCR08.PNG

And here I occasionally get an error when I get data from the NUCLEO board when I press button 1.