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

Assigning a functional block to a GPIO

I'm confused about how to assign a functional block's I/O (TWI in my case) to a particular pin on the device. Is there a worked and documented example? Is there a relevant application note?

Parents
  • Hi,

    Take a look at this example in the SDK: C:\Nordic Semiconductor\nRF51 SDK_v4.3.0.27417\Nordic\nrf51822\Board\nrf6310\twi_sw_master_example

    The pin definition is shown in file "twi_master_config.h". This example uses a bit banged TWI, but if you switch that file with "twi_hw_master.c" instead, then you use the HW peripheral instead.

    The pin selection is done on these two lines: NRF_TWI1->PSELSCL = TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER; NRF_TWI1->PSELSDA = TWI_MASTER_CONFIG_DATA_PIN_NUMBER;

    The defines are basically a GPIO number (between 0 - 30). These two GPIOs will then be controlled by the TWI HW module until you disable the TWI.

  • Sorry, I can't post the code right now on the forum.

    No, I'm not debugging -- where should I start? Any other advice would be appreciated. (I'm still stuck with not having the TWI pins wiggle.)

Reply Children
No Data
Related