I'm using the nRF51822 as SPI slave. My CSN is of wrong polarity (active high). Is it possible to change the settings in spi_slave.c to make it work anyway?
I'm using the nRF51822 as SPI slave. My CSN is of wrong polarity (active high). Is it possible to change the settings in spi_slave.c to make it work anyway?
Hi,
Unfortunately, it is not possible to change the polarity of the CSN line in the SPIS module. You could try one of these options:
You can setup GPIOTE channel or PORT event, port event does not require 16M, so it's more power efficient with the "CSN manipulation". Setup GPIO x with SENSE_HIGH interrupt, GPIO y as output, and GPIO z as the SPIS CSN line. GPIO y and GPIO z must be connected on your PCB.
When the external CSN goes high, it will trigger a GPIOTE event (PORT or using a channel). In the GPIOTE event, you set GPIO y to '0' and it will again trigger the SPIS CSN line.
When the transaction is finished (master CSN is inactive), set GPIO y to '1' again.
Best regards, Håkon
Hi,
Unfortunately, it is not possible to change the polarity of the CSN line in the SPIS module. You could try one of these options:
You can setup GPIOTE channel or PORT event, port event does not require 16M, so it's more power efficient with the "CSN manipulation". Setup GPIO x with SENSE_HIGH interrupt, GPIO y as output, and GPIO z as the SPIS CSN line. GPIO y and GPIO z must be connected on your PCB.
When the external CSN goes high, it will trigger a GPIOTE event (PORT or using a channel). In the GPIOTE event, you set GPIO y to '0' and it will again trigger the SPIS CSN line.
When the transaction is finished (master CSN is inactive), set GPIO y to '1' again.
Best regards, Håkon