Custom NRF52810 board not advertising and hanging on nrf_sdh_enable_request()

Hello all,

I have recently developed a custom board that uses an nrf52810. It also contains an accelerometer as well as some hardware for regulating the voltage and charging a battery. The issue I am having is that the device is unable to advertise. I have been searching around the internet for days however have been unable to find a solution to my problem. I am using sdk17.1.0 and softdevice s112 v7.2.0. I have been trying to use the ble_blinky_pca10040e example to help me start learning to develop for this board. My board does not contain a LF clock and therefore I set it to use the RC in the sdk_config. I have also set the ram and flash sizes appropriately. I have made numerous other modifications to the sdk_config however nothing appears to work. I at first used rtt viewer to see the logs from the device while it ran and it would sometimes throw errors while attempting to set BLE_CONN_CFG_GAP, BLE_GAP_CFG_ROLE_COUNT, etc, sometimes with a fatal error thrown as well. I started using SES to debug the application. When the program is loaded onto the device it runs until it hits ble_stack_init and then either halts on the register at 00000A60, or (more often) gets stuck on the line SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler));. The errors commented above the call make me think that it has something to do with the LF clock config however if I check the configuration it is correct. (set to RC, accuracy to 1, RC_CTIV 16, RC_TEMP_CTIV to 2), and I can also see the correct values in the variable when debugging. The device is able to run examples that do not involve BLE (like the blinky example) without issue. This is my first time taking on a project this large and I will admit at this point I am feeling rather lost. Any assistance is greatly appreciated. I am also happy to upload any code or hardware files should anyone require them. 

Thank you!

Parents
  • Hi there,

    The ram and flash sizes shouldn't be adjusted if you're using a PCA10040e example. If you're using a custom board then you need to add a custom board file for the pins on the board to be mapped correctly. Can you try flashing the attached example to your board? It writes directly to the registers of the nRF and starts transmitting with the radio. This example is not dependent on the board file so you don't need to add one for this to work. If the resources that is needed to use the radio has been configured correctly, then you should see some radio activity if you use the nRF Connect RSSI app.

    1. Just copy and past the code into the blinky PCA10040e example.
    2. Build the project and flash it to your IC.
    3. Open the RSSI app on your computer with a devkit.
    4. See if you see any radio activity.

    Could you also upload your schematics(I made the case private)?

    #include <nrf.h>
    
    int main(void)
    {
      // Packet to send
      uint8_t packet[16] = "demopacket";
      
      // Start HFCLK from crystal oscillator. The radio needs crystal to function correctly.
      NRF_CLOCK->TASKS_HFCLKSTART = 1;
      while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
      
      // Configure radio with 2Mbit Nordic proprietary mode
      NRF_RADIO->MODE = RADIO_MODE_MODE_Nrf_2Mbit << RADIO_MODE_MODE_Pos;
      
      // Configure packet with no S0,S1 or Length fields and 8-bit preamble.
      NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_LFLEN_Pos) |
                         (0 << RADIO_PCNF0_S0LEN_Pos) |
                         (0 << RADIO_PCNF0_S1LEN_Pos) | 
                         (RADIO_PCNF0_S1INCL_Automatic << RADIO_PCNF0_S1INCL_Pos) |
                         (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos);
      
      // Configure static payload length of 16 bytes. 3 bytes address, little endian with whitening enabled.
      NRF_RADIO->PCNF1 =  (16 << RADIO_PCNF1_MAXLEN_Pos) |
                          (16 << RADIO_PCNF1_STATLEN_Pos) |
                          (2  << RADIO_PCNF1_BALEN_Pos) | 
                          (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
                          (RADIO_PCNF1_WHITEEN_Enabled << RADIO_PCNF1_WHITEEN_Pos);
      
      // initialize whitening value
      NRF_RADIO->DATAWHITEIV = 0x55;
      
      // Configure address Prefix0 + Base0
      NRF_RADIO->BASE0   = 0x0000BABE;
      NRF_RADIO->PREFIX0 = 0x41 << RADIO_PREFIX0_AP0_Pos;
      
      // Use logical address 0 (BASE0 + PREFIX0 byte 0)
      NRF_RADIO->TXADDRESS = 0 << RADIO_TXADDRESS_TXADDRESS_Pos;
      
      // Initialize CRC (two bytes)
      NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos) |
                          (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos);
      NRF_RADIO->CRCPOLY = 0x0000AAAA;
      NRF_RADIO->CRCINIT = 0x12345678;
      
      // Enable fast rampup, new in nRF52
      NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_DTX_B0 << RADIO_MODECNF0_DTX_Pos) |
                            (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos);
                            
      // 0dBm output power, sending packets at 2400MHz
      NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos;
      NRF_RADIO->FREQUENCY = 0 << RADIO_FREQUENCY_FREQUENCY_Pos;
      
      // Configure address of the packet and logic address to use
      NRF_RADIO->PACKETPTR = (uint32_t)&packet[0];
      
      // Configure shortcuts to start as soon as READY event is received, and disable radio as soon as packet is sent.
      NRF_RADIO->SHORTS = (RADIO_SHORTS_READY_START_Enabled << RADIO_SHORTS_READY_START_Pos) |
                          (RADIO_SHORTS_END_DISABLE_Enabled << RADIO_SHORTS_END_DISABLE_Pos);
      
      // Continuously send the same packet
      while (1)
      {
        NRF_RADIO->TASKS_TXEN = 1;
        while (NRF_RADIO->EVENTS_DISABLED == 0);
        NRF_RADIO->EVENTS_DISABLED = 0;
      }
    }
    

    regards

    Jared 

Reply
  • Hi there,

    The ram and flash sizes shouldn't be adjusted if you're using a PCA10040e example. If you're using a custom board then you need to add a custom board file for the pins on the board to be mapped correctly. Can you try flashing the attached example to your board? It writes directly to the registers of the nRF and starts transmitting with the radio. This example is not dependent on the board file so you don't need to add one for this to work. If the resources that is needed to use the radio has been configured correctly, then you should see some radio activity if you use the nRF Connect RSSI app.

    1. Just copy and past the code into the blinky PCA10040e example.
    2. Build the project and flash it to your IC.
    3. Open the RSSI app on your computer with a devkit.
    4. See if you see any radio activity.

    Could you also upload your schematics(I made the case private)?

    #include <nrf.h>
    
    int main(void)
    {
      // Packet to send
      uint8_t packet[16] = "demopacket";
      
      // Start HFCLK from crystal oscillator. The radio needs crystal to function correctly.
      NRF_CLOCK->TASKS_HFCLKSTART = 1;
      while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
      
      // Configure radio with 2Mbit Nordic proprietary mode
      NRF_RADIO->MODE = RADIO_MODE_MODE_Nrf_2Mbit << RADIO_MODE_MODE_Pos;
      
      // Configure packet with no S0,S1 or Length fields and 8-bit preamble.
      NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_LFLEN_Pos) |
                         (0 << RADIO_PCNF0_S0LEN_Pos) |
                         (0 << RADIO_PCNF0_S1LEN_Pos) | 
                         (RADIO_PCNF0_S1INCL_Automatic << RADIO_PCNF0_S1INCL_Pos) |
                         (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos);
      
      // Configure static payload length of 16 bytes. 3 bytes address, little endian with whitening enabled.
      NRF_RADIO->PCNF1 =  (16 << RADIO_PCNF1_MAXLEN_Pos) |
                          (16 << RADIO_PCNF1_STATLEN_Pos) |
                          (2  << RADIO_PCNF1_BALEN_Pos) | 
                          (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
                          (RADIO_PCNF1_WHITEEN_Enabled << RADIO_PCNF1_WHITEEN_Pos);
      
      // initialize whitening value
      NRF_RADIO->DATAWHITEIV = 0x55;
      
      // Configure address Prefix0 + Base0
      NRF_RADIO->BASE0   = 0x0000BABE;
      NRF_RADIO->PREFIX0 = 0x41 << RADIO_PREFIX0_AP0_Pos;
      
      // Use logical address 0 (BASE0 + PREFIX0 byte 0)
      NRF_RADIO->TXADDRESS = 0 << RADIO_TXADDRESS_TXADDRESS_Pos;
      
      // Initialize CRC (two bytes)
      NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos) |
                          (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos);
      NRF_RADIO->CRCPOLY = 0x0000AAAA;
      NRF_RADIO->CRCINIT = 0x12345678;
      
      // Enable fast rampup, new in nRF52
      NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_DTX_B0 << RADIO_MODECNF0_DTX_Pos) |
                            (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos);
                            
      // 0dBm output power, sending packets at 2400MHz
      NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos;
      NRF_RADIO->FREQUENCY = 0 << RADIO_FREQUENCY_FREQUENCY_Pos;
      
      // Configure address of the packet and logic address to use
      NRF_RADIO->PACKETPTR = (uint32_t)&packet[0];
      
      // Configure shortcuts to start as soon as READY event is received, and disable radio as soon as packet is sent.
      NRF_RADIO->SHORTS = (RADIO_SHORTS_READY_START_Enabled << RADIO_SHORTS_READY_START_Pos) |
                          (RADIO_SHORTS_END_DISABLE_Enabled << RADIO_SHORTS_END_DISABLE_Pos);
      
      // Continuously send the same packet
      while (1)
      {
        NRF_RADIO->TASKS_TXEN = 1;
        while (NRF_RADIO->EVENTS_DISABLED == 0);
        NRF_RADIO->EVENTS_DISABLED = 0;
      }
    }
    

    regards

    Jared 

Children
No Data
Related