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?
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?
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.
By the way, I'm using the Revision 1.0 of the nRF51822 Evaluation Kit if that makes any difference.
By the way, I'm using the Revision 1.0 of the nRF51822 Evaluation Kit if that makes any difference.