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

nrf52832 how to increase duty cycle to 98%

Hi Team,
Currently we are working with nrf52832 in one of our project and now we are going through FCC for the same. I am using radio tool code(SDK 15.3) to generate the FCC images for different channels. I am able to generate waveforms when i am using radio_modulated_tx_carrier() function. But in the testing we have observed that, with these we are able to achieve only 25% duty cycle. To increase the duty cycle, i have used radio_modulated_tx_carrier_duty_cycle() function, but after introducing this function i am not seeing wave forms in the spectrum. following is the code snippet

while (true){
uint8_t txpower_ = RADIO_TXPOWER_TXPOWER_Pos4dBm;
uint8_t mode_ = RADIO_MODE_MODE_Ble_1Mbit;
uint8_t channel_start_ = 40;
uint8_t duty_cycle = 98;

radio_modulated_tx_carrier_duty_cycle(txpower_,
mode_,
channel_start_,
duty_cycle);
}

Kindly let us know how to increase the duty cycle to 98%.

  • Hi Ramesh,

     

    Yes, you are right, sorry for not catching that. It seems to in some way or another be due to the radio not using fast ramp-up, enabling that seems to do the trick. I tested on my side with a proper spectrum analyzer this time, radio_modulated_tx_carrier_duty_cycle() for reference:

    void radio_modulated_tx_carrier_duty_cycle(uint8_t txpower,
                                               uint8_t mode,
                                               uint8_t channel,
                                               uint8_t duty_cycle)
    {
        // Lookup table with time per byte in each radio MODE
        // Mapped per NRF_RADIO->MODE available on nRF5-series devices @ref <insert ref to mode register>
        static const uint8_t time_in_us_per_byte[16] =
        {8, 4, 32, 8, 4, 64, 16, 0, 0, 0, 0, 0, 0, 0, 0, 32};
        // 1 byte preamble, 5 byte address (BALEN + PREFIX), and sizeof(payload), no CRC
        const uint32_t total_payload_size     = 1 + 5 + sizeof(m_tx_packet);
        const uint32_t total_time_per_payload = time_in_us_per_byte[mode] * total_payload_size;
        // Duty cycle = 100 * Time_on / (time_on + time_off), we need to calculate "time_off" for delay.
        // In addition, the timer includes the "total_time_per_payload", so we need to add this to the total timer cycle.
        uint32_t delay_time = total_time_per_payload +
                              ((100 * total_time_per_payload -
                              (total_time_per_payload * duty_cycle)) / duty_cycle);
    
        CRITICAL_REGION_ENTER();
        radio_disable();
        generate_modulated_rf_packet(mode);
        // We let the TIMER start the radio transmission again.
    
    
        NRF_RADIO->SHORTS    = RADIO_SHORTS_END_DISABLE_Msk | RADIO_SHORTS_READY_START_Msk;
        NRF_RADIO->TXPOWER   = (txpower << RADIO_TXPOWER_TXPOWER_Pos);
        NRF_RADIO->MODE      = (mode << RADIO_MODE_MODE_Pos);
        NRF_RADIO->FREQUENCY = channel;
    
        radio_channel_set(mode, channel);
    
        NRF_RADIO->MODECNF0 = 0x2001; // DTX = center, RU = fast
    
        NRF_TIMER0->TASKS_STOP  = 1;
        NRF_TIMER0->TASKS_CLEAR = 1;
        NRF_TIMER0->INTENSET    = (TIMER_INTENSET_COMPARE1_Set << TIMER_INTENSET_COMPARE1_Pos);
        NRF_TIMER0->SHORTS      =
            (TIMER_SHORTS_COMPARE1_CLEAR_Enabled << TIMER_SHORTS_COMPARE1_CLEAR_Pos);
        // Clear CC[0], in case sweep TX/RX was previously active
        NRF_TIMER0->CC[0]             = 0;
        NRF_TIMER0->CC[1]             = delay_time;
        NRF_TIMER0->EVENTS_COMPARE[0] = 0;
        NRF_TIMER0->EVENTS_COMPARE[1] = 0;
        NRF_TIMER0->BITMODE           = (TIMER_BITMODE_BITMODE_24Bit << TIMER_BITMODE_BITMODE_Pos);
        NRF_TIMER0->PRESCALER         = 4; // resolution of 1 µs
        NRF_TIMER0->TASKS_START       = 1;
        
        CRITICAL_REGION_EXIT();
    }

     

    Note line 32.

     

    Best regards,

    Andreas

Related