This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Frequency width and Modulation/Non-modulation

Hi. I'm using nRF51822, S130, SDK10.0.0. I made a source code as below refering radio_test which is in SDK examples. But the width of frequency is just 0.2MHz as below. As I know, width of 1 channel frequency is 2MHz.

image description

void radio_tx_carrier_test(unsigned char freq_ch) {

NRF_RNG->TASKS_START = 1;

// Start 16 MHz crystal oscillator
NRF_CLOCK->EVENTS_HFCLKSTARTED  = 0;
NRF_CLOCK->TASKS_HFCLKSTART     = 1;

// Wait for the external oscillator to start up
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
{
    // Do nothing.
}  

NRF_RADIO->SHORTS		   = 0;
NRF_RADIO->EVENTS_DISABLED = 0;
NRF_RADIO->TEST 		   = 0;
NRF_RADIO->TASKS_DISABLE   = 1;
while (NRF_RADIO->EVENTS_DISABLED == 0)
{
	// Do nothing.
}
NRF_RADIO->EVENTS_DISABLED = 0;

NRF_RADIO->SHORTS	  = RADIO_SHORTS_READY_START_Msk;
NRF_RADIO->TXPOWER	  = (4 << RADIO_TXPOWER_TXPOWER_Pos);	 
NRF_RADIO->MODE 	  = (RADIO_MODE_MODE_Nrf_2Mbit << RADIO_MODE_MODE_Pos);
if(freq_ch>100)
{
	if(freq_ch==101) NRF_RADIO->FREQUENCY = 2;
	else if(freq_ch==102) NRF_RADIO->FREQUENCY = 40;
	else if(freq_ch==103) NRF_RADIO->FREQUENCY = 80;
	else if(freq_ch==200) NRF_RADIO->FREQUENCY = 45;
}
else NRF_RADIO->FREQUENCY  = freq_ch*2;
NRF_RADIO->TEST 	  = (RADIO_TEST_CONSTCARRIER_Enabled << RADIO_TEST_CONSTCARRIER_Pos) \
						| (RADIO_TEST_PLLLOCK_Enabled << RADIO_TEST_PLLLOCK_Pos);

NRF_RADIO->TASKS_TXEN = 1;
NRF_POWER->DCDCEN = 1;

}

int main(void) {

g_freq_ch=101;
radio_tx_carrier_test(g_freq_ch);
while(1)
{
	__WFI();
	;
}

}

What could be the problem of my source code?

And one more question. As i already asked as below link, devzone.nordicsemi.com/.../ nRF51822 doesn't support non-modulation RF as reply mentioned.

But as you can see, the waveform looks non-modulation frequency. Is this really modulated frequency?

I need your help. Please answer my question.

  • I think I may have been a bit unclear in this answer. The only available modulation type is GFSK, in four variants (different bit rates and modulation index). However, you can output an unmodulated carrier signal by setting the CONSTCARRIER field of the TEST register.

    As far as I can see, you are configuring the radio to output an unmodulated carrier with the following line from your code:

    NRF_RADIO->TEST       = (RADIO_TEST_CONSTCARRIER_Enabled << RADIO_TEST_CONSTCARRIER_Pos) \
                            | (RADIO_TEST_PLLLOCK_Enabled << RADIO_TEST_PLLLOCK_Pos);
    

    The spectrum plot you have uploaded seems to be in line with what you would expect with the radio configured for an unmodulated carrier output. If you do not enable constant carrier, but instead output some data, you would see that the signal would require more bandwidth (be wider). The easiest way to test this is to use the radio test example or simply copy what you need from there. The radio_modulated_tx_carrier() will generate and output a random packet on a specified channel, with a specified modulation mode and output power.

  • Thank you very much. Very helpful.

Related