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.
Are you debugging while doing this? Have you ensured that the device has not crashed or similar?
Can you attach your source code + keil uvproj files so I can have a look?
Are you debugging while doing this? Have you ensured that the device has not crashed or similar?
Can you attach your source code + keil uvproj files so I can have a look?