This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RXREADY event not received after triggering TASKS_RXEN

Hello,

I'm using the nrf52840 to try and receive a byte from the nRF24l01+.

After configuring, I trigger TASKS_RXEN, but never receive EVENTS_RXREADY.

Here is the code:

void radio_config(void)
{   
    *((uint32_t *)(RADIO_BASE + RADIO_POWER)) = 0;
    *((uint32_t *)(RADIO_BASE + RADIO_POWER)) = 1;

    *((uint32_t *)(RADIO_BASE + RADIO_FREQUENCY)) = 2;

    *((uint32_t *)(RADIO_BASE + RADIO_SHORTS)) = 0;

    *((uint32_t *)(RADIO_BASE + RADIO_TXPOWER)) = 0x8; // 8 dBm

    *((uint32_t *)(RADIO_BASE + RADIO_MODE)) = 0; 

    *((uint32_t *)(RADIO_BASE + RADIO_PREFIX0)) = 0xE7;
    *((uint32_t *)(RADIO_BASE + RADIO_BASE0)) = 0xE7E7E7E7;
    *((uint32_t *)(RADIO_BASE + RADIO_RXADDRESSES)) = 1; 

    // LFLEN=6, S0LEN=0, S1LEN=3, S1INCL=1, CILEN=0, PLEN=0, CRCINC=0, TERMLEN=0
    *((uint32_t *)(RADIO_BASE + RADIO_PCNF0)) =
        (6 << RADIO_PCNF0_LFLEN) | (0 << RADIO_PCNF0_S0LEN) |
        (3 << RADIO_PCNF0_S1LEN) | (1 << RADIO_PCNF0_S1INCL) |
        (0 << RADIO_PCNF0_CILEN) | (0 << RADIO_PCNF0_PLEN) |
        (0 << RADIO_PCNF0_CRCINC) | (0 << RADIO_TERMLEN);
    
    // MAXLEN=32, STALEN=0, BALEN=4, ENDIAN=(0?), WHITEEN=(0?)
    // *((uint32_t *)(RADIO_BASE + RADIO_PCNF1)) = 0x00040040;
    *((uint32_t *)(RADIO_BASE + RADIO_PCNF1)) = 
        (32 << RADIO_PCNF1_MAXLEN) | (0 << RADIO_PCNF1_STATLEN) | 
        (4 << RADIO_PCNF1_BALEN) | (0 << RADIO_PCNF1_ENDIAN) |
        (0 << RADIO_PCNF1_WHITEEN);

    *((uint32_t *)(RADIO_BASE + RADIO_TIFS)) = 150;
    
    *((uint32_t *)(RADIO_BASE + RADIO_CRCPOLY)) =
        (1 << 8) | (1 << 2) | (1 << 1) | (1 << 0);
    *((uint32_t *)(RADIO_BASE + RADIO_CRCCNF)) = 1;
    *((uint32_t *)(RADIO_BASE + RADIO_CRCINIT)) = 0xFF;
    
    *((uint32_t *)(RADIO_BASE + RADIO_PACKETPTR)) = (uint32_t)RADIO_DMA_BASE;
    
}

void radio_start(void)
{
    *((uint32_t *)(RADIO_BASE + RADIO_EVENTS_READY)) = 0;
    // start the rx ramp up
    *((uint32_t *)(RADIO_BASE + RADIO_TASKS_RXEN)) = 1; // receiver mode, begin rx ramp up
    
    gpio_write_n(LED1, 1);
    while (*((uint32_t *)RADIO_BASE + RADIO_EVENTS_RXREADY) == 0);
    gpio_write_n(LED2, 1);
}

radio_start() is called immediately after radio_config().

I prefer not to use the SDK... Sorry... I've verified all the register addresses and bit definitions with the manual, so I don't think that's the problem.

One strange thing is that if I trigger TASKS_TXEN, I do receive EVENTS_TXREADY. I've also verified by reading the STATE register that after triggering RXEN, the state remains in RXRU, whereas if I trigger TXEN, the state moves to TXIDLE.

EDIT: Need to make a correction. The value in the state register is 2, as expected for RXIDLE, but the event still isn't received.

Related