How to select SPI mode for nrf52840

Hi,

I am trying to interface nrf52840 with Arducam mini OV2640 2mp. I am trying to implement SPIM to communicate with the arducam. In the arducam OV2640 datasheet, to enable SPI communication, it is mentioned that "The ArduCAM SPI slave interface is fixed SPI mode 0 with POL = 0 and PHA = 1". In the nRF52840 product specification, different modes are mentioned for configuration as shown in the image below. I am confused which mode of nrf52840  should I select such that it corresponds to Arducam SPI mode POL=0 and PHA=1. 

nrf52840 datasheet

Parents
  • Hi,

    If you want POL=0 and PHA=1, then you should use CPOL=0 and CPHA=1, which is SPI mode 1.

    Typically you can configure the SPI mode used when init the spi driver, something like:

    config_spim.mode = NRF_SPIM_MODE_1, ///< SCK active high, sample on trailing edge of clock.

    If any problems please connect a logic analzer to look at the SPI pins (CLK, MISO and MOSI) along with the chip select pin (CSN).

    Kenneth

Reply
  • Hi,

    If you want POL=0 and PHA=1, then you should use CPOL=0 and CPHA=1, which is SPI mode 1.

    Typically you can configure the SPI mode used when init the spi driver, something like:

    config_spim.mode = NRF_SPIM_MODE_1, ///< SCK active high, sample on trailing edge of clock.

    If any problems please connect a logic analzer to look at the SPI pins (CLK, MISO and MOSI) along with the chip select pin (CSN).

    Kenneth

Children
Related