Hi ,
I am programming nRF51822(s/n 681859006) on my company's custom board, I am using the softdevice (s110_nrf51_8.0.0_softdevice.hex) to program it.
After successful compilation , I am not able to see my BLE advertising.
Please help.
Thanks, Abhi
Hi ,
I am programming nRF51822(s/n 681859006) on my company's custom board, I am using the softdevice (s110_nrf51_8.0.0_softdevice.hex) to program it.
After successful compilation , I am not able to see my BLE advertising.
Please help.
Thanks, Abhi
Start by hooking up a current meter to the device, and verify that you see the correct current draws for different use cases, ie. writing NRF_RADIO->TASKS_TXEN = 1; should give you a current draw of ~15mA depending on power supply configuration.
Try checking that you have loaded the HF crystal properly, if you can measure this with a spectrum analyzer that is best. The way to do it is to measure on the RF output, and see how much it is off. Alternately you can use this code to set up a 8 MHz signal on a GPIO, if it measures as anything else that 8 MHz there's a problem with your clock.
int main(void)
{
// Set up GPIO as output
nrf_gpio_range_cfg_output(17, 18);
nrf_gpio_pin_clear(17); // Light LED 1 to indicate that the code is running
// Start high frequency clock
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
{
// Wait for clock to start
}
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
// Configure GPIOTE to toggle pin 18
NRF_GPIOTE->CONFIG[0] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos |
18 << GPIOTE_CONFIG_PSEL_Pos |
GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos;
// Set up timer
NRF_TIMER1->PRESCALER = 0;
NRF_TIMER1->CC[0] = 2; // Adjust the output frequency by adjusting the CC.
NRF_TIMER1->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos;
NRF_TIMER1->TASKS_START = 1;
// Set up PPI to connect the timer compare event with the GPIOTE toggle task
NRF_PPI->CH[0].EEP = (uint32_t) &NRF_TIMER1->EVENTS_COMPARE[0];
NRF_PPI->CH[0].TEP = (uint32_t) &NRF_GPIOTE->TASKS_OUT[0];
NRF_PPI->CHENSET = PPI_CHENSET_CH0_Enabled << PPI_CHENSET_CH0_Pos;
while (true)
{
}
}
Start by hooking up a current meter to the device, and verify that you see the correct current draws for different use cases, ie. writing NRF_RADIO->TASKS_TXEN = 1; should give you a current draw of ~15mA depending on power supply configuration.
Try checking that you have loaded the HF crystal properly, if you can measure this with a spectrum analyzer that is best. The way to do it is to measure on the RF output, and see how much it is off. Alternately you can use this code to set up a 8 MHz signal on a GPIO, if it measures as anything else that 8 MHz there's a problem with your clock.
int main(void)
{
// Set up GPIO as output
nrf_gpio_range_cfg_output(17, 18);
nrf_gpio_pin_clear(17); // Light LED 1 to indicate that the code is running
// Start high frequency clock
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
{
// Wait for clock to start
}
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
// Configure GPIOTE to toggle pin 18
NRF_GPIOTE->CONFIG[0] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos |
18 << GPIOTE_CONFIG_PSEL_Pos |
GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos;
// Set up timer
NRF_TIMER1->PRESCALER = 0;
NRF_TIMER1->CC[0] = 2; // Adjust the output frequency by adjusting the CC.
NRF_TIMER1->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos;
NRF_TIMER1->TASKS_START = 1;
// Set up PPI to connect the timer compare event with the GPIOTE toggle task
NRF_PPI->CH[0].EEP = (uint32_t) &NRF_TIMER1->EVENTS_COMPARE[0];
NRF_PPI->CH[0].TEP = (uint32_t) &NRF_GPIOTE->TASKS_OUT[0];
NRF_PPI->CHENSET = PPI_CHENSET_CH0_Enabled << PPI_CHENSET_CH0_Pos;
while (true)
{
}
}