Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Accessing the nrf52820 pins

Hello all

I am porting the code from the nRF52DK to the nrf52820, and so far so good, however, I am having a question, when configuring the TWI, will this get me the right PINS, for instance, according to the module manufacturer I should be accessing the P0.02 for SDA, while P0.08 for the SCL , this is my code:

void twi_init (void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_config = {
       .scl                = NRF_GPIO_PIN_MAP(0, 8), // ARDUINO_SCL_PIN,   //Add you SCL Pin Here
       .sda                = NRF_GPIO_PIN_MAP(0, 2), // ARDUINO_SDA_PIN,   //Add you SDA Pin Here
       .frequency          = NRF_DRV_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };

    err_code = nrf_drv_twi_init(&m_twi, &twi_config, twi_handler, NULL);
    APP_ERROR_CHECK(err_code);

    nrf_drv_twi_enable(&m_twi);
}

This part works on the nrf52dk, for example where I am directly using the P0.27 and P0.26, however, the numbers 26 and 27 are simply used, as 26 and 27... 

hence my question, if I am accessing the pins correctly?

best.

Parents Reply
  • Hi Mura,

    Panasonic PAN1781 is just a module.
    What is vendor of the rest of the hardware?

    One of advantage of the Noridc micrcontroller nrf52 is you can configure the routing of IO pins.
    So they are not fixed, yet.
    The TWI port/pins of the nrf52820 inside the pan1781 module are becoming fixed by solder the pan1781 and external parts onto the PCB. 


    Thus a electrical drawing of your board is mandatory to find out the TWI port/pins.

    Kind regards,
       nRF5xFanBoy

Children
Related