I used the sample code from nordic with nRF51822. DTM works fine. sensibility test gives me 0% on the 3 channels. Perfect.
Then I copied and paste into my code, calling it directly after main. The test gives me other results !! I don't understand.
But if I have this code
// Same as nordic except for the 4 lines I add at the end
for (;;)
{
// Will return every timeout, 625 us.
current_time = dtm_wait();
if (NRF_UART0->EVENTS_RXDRDY == 0)
{
// Nothing read from the UART.
continue;
}
NRF_UART0->EVENTS_RXDRDY = 0;
rx_byte = (uint8_t)NRF_UART0->RXD;
// ////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////
// THESE 4 LINES ARE THE LINES I ADD
// ////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////
if((rx_byte == 0x61) && (!is_msb_read))
{
uart_put_char16(0x4F4B);
continue;
}
...
So if I do this, the test works again (0%, 0%, 0%). If instead of 0x61 I do 0x62, it works too but (0.5%, 0%, 0%). If instead of 0x4F4B I do 0x1234, similar result : almost 0% but not.
So I am confused. First I don't know why my copy and paste code doesn't give the same result as nordic, and second I don't know why adding my uart_put_char16 makes the test work better than nordic sample code.
Any ideas ? Thanks