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

Direction finding with manual configuration

Hello,

I am having two nRF5340 PDK and try to perform AoA direction finding on the two boards. 

The board is programmed with a customized code which let the board transmit every 0.5 seconds, all rest time the board just listens for frames. In practical, the two boards will transmit and receive frame  each other periodically.

I am trying to use the manual configuration way.  The following is my configuration code. I believe I did everything right in the code. When I connect the P1.06, P1.07, P1.08, P1.09, P1.10 to a logic analyzer, according to my switchpattern,  I expected to see 5 plus happened chronological.  However in practical I only saw P1.06 is set to high after enable Rx, and turned to low right before the EVENT_END happens (a pin is toggled when EVENT_END happens, the )1.06 turns to low 0.4us right before that). 

The communication is still fine, the packet are correctly received. 

Did anyone have a clue where I may configure it wrong? Thanks!

P.S.  

For the APP core, I programmed with code which reserves those GPIO pins to network core and release the network.forceoff. Then it does while(1) loop.

The program I explained above is the software for the network core. I confirm that those pins can be used to turn on/off using GPIO peripheral. But not working as expected when used for radio performing direction finding.  

#define ANT_SWITCH_PORT           1
#define ANT_SWITCH_PIN0           6
#define ANT_SWITCH_PIN1           7
#define ANT_SWITCH_PIN2           8
#define ANT_SWITCH_PIN3           9
#define ANT_SWITCH_PIN4           10

NRF_P1_NS->OUTCLR = 0x00007C00;
    nrf_gpio_cfg_output(ANT_SWITCH_PORT,  ANT_SWITCH_PIN0);
    nrf_gpio_cfg_output(ANT_SWITCH_PORT,  ANT_SWITCH_PIN1);
    nrf_gpio_cfg_output(ANT_SWITCH_PORT,  ANT_SWITCH_PIN2);
    nrf_gpio_cfg_output(ANT_SWITCH_PORT,  ANT_SWITCH_PIN3);
    nrf_gpio_cfg_output(ANT_SWITCH_PORT,  ANT_SWITCH_PIN4);
        
    // configure GPIO pins
    NRF_RADIO_NS->PSEL.DFEGPIO[0] = (uint32_t)(
                                        (ANT_SWITCH_PORT << 5)      |
                                        (ANT_SWITCH_PIN0 << 0)      |
                                        (0 << 31)
                                    );
    NRF_RADIO_NS->PSEL.DFEGPIO[1] = (uint32_t)(
                                        (ANT_SWITCH_PORT << 5)      |
                                        (ANT_SWITCH_PIN1 << 0)      |
                                        (0 << 31)
                                    );
    NRF_RADIO_NS->PSEL.DFEGPIO[2] = (uint32_t)(
                                        (ANT_SWITCH_PORT << 5)      |
                                        (ANT_SWITCH_PIN2 << 0)      |
                                        (0 << 31)
                                    );
    NRF_RADIO_NS->PSEL.DFEGPIO[3] = (uint32_t)(
                                        (ANT_SWITCH_PORT << 5)      |
                                        (ANT_SWITCH_PIN3 << 0)      |
                                        (0 << 31)
                                    );
    NRF_RADIO_NS->PSEL.DFEGPIO[4] = (uint32_t)(
                                        (ANT_SWITCH_PORT << 5)      |
                                        (ANT_SWITCH_PIN4 << 0)      |
                                        (0 << 31)
                                    );
                                    
// write switch pattern
    NRF_RADIO_NS->CLEARPATTERN  = (uint32_t)1;

    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<0);
    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<0);
    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<1);
    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<2);
    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<3);
    NRF_RADIO_NS->SWITCHPATTERN = (uint32_t)(1<<4);

    // enable direction finding in AoA mode
    NRF_RADIO_NS->DFEMODE = (uint32_t)DFEOPMODE_AOA;

    NRF_RADIO_NS->DFECTRL1          = (uint32_t)(NUMBEROF8US << 0)        | 
                                      (uint32_t)(DFEINEXTENSION << 7)     |
                                      (uint32_t)(TSWITCHSPACING << 8)     |
                                      (uint32_t)(TSAMPLESPACINGREF << 12) |
                                      (uint32_t)(SAMPLETYPE << 15)        |
                                      (uint32_t)(TSAMPLESPACING << 16);

    NRF_RADIO_NS->DFECTRL2          = (uint32_t)(TSWITCHOFFSET << 0) |
                                      (uint32_t)(TSAMPLEOFFSET << 0);
  

    NRF_RADIO_NS->DFEPACKET.MAXCNT  = SAMPLE_MAXCNT;
    NRF_RADIO_NS->DFEPACKET.PTR     = (uint32_t)(&radio_vars.df_samples[0]);

Related