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

Best place to get started

Hello everyone.

I've got the nRF51822 Evaluation Kit and Dongle. The heartbeat demo is working, so I got the toolchain -- Nordic, Keil, Segger under Win7 -- set up correctly, as far as I can tell.

I need to interface with an I2C/TWI device as one of my peripherals, and was wondering what is the best way to start a new project, and if there's a template that I could use that will do much of the required setup (SoftDevice, initialisation, etc.) for me. Or do most people simply start off with the example code and build on top of that?

Finally, is there a "getting started" guide anywhere? I couldn't find one on the Nordic website.

Thanks!

Parents
  • Hi,

    I'm using the attached, modified, SoftDevice compatible TWI code with the BLE heart rate example for the pca10001. I initialize the TWI master like in this order:

    int main(void)
    {
        uint32_t err_code;
    
        timers_init();
        gpiote_init();
        buttons_init();
    	
        // Initialize TWI
        twi_master_init();
    

    and the code fails at the asserts and forces a system reset...

        /*
        NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TWI1->EVENTS_BB;
        NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_SUSPEND;
        NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk;*/
        err_code = sd_ppi_channel_assign(0,
                                         &(NRF_TWI1->EVENTS_BB),
                                         &(NRF_TWI1->TASKS_SUSPEND));
        ASSERT(err_code == NRF_SUCCESS);
    

    What is the problem here, shall I initialize the TWI in a different order?

Reply
  • Hi,

    I'm using the attached, modified, SoftDevice compatible TWI code with the BLE heart rate example for the pca10001. I initialize the TWI master like in this order:

    int main(void)
    {
        uint32_t err_code;
    
        timers_init();
        gpiote_init();
        buttons_init();
    	
        // Initialize TWI
        twi_master_init();
    

    and the code fails at the asserts and forces a system reset...

        /*
        NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TWI1->EVENTS_BB;
        NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_SUSPEND;
        NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk;*/
        err_code = sd_ppi_channel_assign(0,
                                         &(NRF_TWI1->EVENTS_BB),
                                         &(NRF_TWI1->TASKS_SUSPEND));
        ASSERT(err_code == NRF_SUCCESS);
    

    What is the problem here, shall I initialize the TWI in a different order?

Children
Related