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

Thingy 52

Hello everyone,

Is it possible to add an external flash memory like this one here:
www.digikey.com/.../4211595
on nRF52?

Thank you in advance!

Parents
  • That flash memory mx25l25735f has single, dual and quad SPI interfaces. The nRF52 can certainly handle a single SPI bus, so it will be possible to connect the flash memory though it won't get the maximum data throughput with a single SPI. I don't know if the nRF52 can handle dual or quad SPI.

    The nRF52 can work with a supply voltage from 17V to 3.6V so the flash working at 3V can be accommodated.

    Looking at the thing 52 there are plenty of places to solder in, so that should be easy.

    That leaves you the task of wiring it in and writing the software to read/write the flash memory - it looks a capable device.

  • Well my task is to do it on thingy52, so I must use nRF52832. Can you suggest how to wire it, its confusing to me, I can use any random GPIO's to connect flash with nRF52(for SPI)? Can you give an example how would you connect it?
    Sorry for bothering you further, it would mean a lot. Thank you.

  • For the wiring

    The easy flash pins are VCC and GND

    As a minimum the SPI bus has CS#, SCLK, MISO (SO), MOSI (SI).

    After a quick scan of the datasheet, there is a HOLD# pin that can be tied high and a WP# pin that can be tied high too.

    On my Thingy 52 there are just three port pins marked on the large P4 connector : P0.02, P0.03 and P0.04

    That's not enough for the SPI bus. I would assign the fast changing signals SCLK, MISO and MOSI to those and use another pin for the slow changing chip select.

    EXT.0 .. EXT.3 seem to be through a GPIO expander. I'd tie CS# to EXT0. You could tie HOLD# and WP# to others if needed.

    For the software

    I'm using the DK but the software should be similar to this...

    nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(1);

    nrf_drv_spi_config_t cfg;

    void init(void)
    {
      cfg.frequency = NRF_DRV_SPI_FREQ_1M;
      cfg.sck_pin = 2; // P0.02
      cfg.miso_pin = 3; // P0.03
      cfg.mosi_pin = 4; // P0.04
      cfg.ss_pin = NRF_DRV_SPI_PIN_NOT_USED;
      cfg.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;

      // NULL : No handler, operates in blocking mode
      uint32_t result = nrf_drv_spi_init(&spi, &cfg, NULL);

      if (NRF_SUCCESS != result)
      {
      // error
      }

    }

    static uint8_t junk;
    static uint8_t data = 0;

    // use GPIO expander for chip select

    data = <value here>;

    uint32_t result = nrf_drv_spi_transfer (&spi, (uint8_t*)&data, 1, &junk, 1);

    if (NRF_SUCCESS != result)
    {
    // err
    }

Reply
  • For the wiring

    The easy flash pins are VCC and GND

    As a minimum the SPI bus has CS#, SCLK, MISO (SO), MOSI (SI).

    After a quick scan of the datasheet, there is a HOLD# pin that can be tied high and a WP# pin that can be tied high too.

    On my Thingy 52 there are just three port pins marked on the large P4 connector : P0.02, P0.03 and P0.04

    That's not enough for the SPI bus. I would assign the fast changing signals SCLK, MISO and MOSI to those and use another pin for the slow changing chip select.

    EXT.0 .. EXT.3 seem to be through a GPIO expander. I'd tie CS# to EXT0. You could tie HOLD# and WP# to others if needed.

    For the software

    I'm using the DK but the software should be similar to this...

    nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(1);

    nrf_drv_spi_config_t cfg;

    void init(void)
    {
      cfg.frequency = NRF_DRV_SPI_FREQ_1M;
      cfg.sck_pin = 2; // P0.02
      cfg.miso_pin = 3; // P0.03
      cfg.mosi_pin = 4; // P0.04
      cfg.ss_pin = NRF_DRV_SPI_PIN_NOT_USED;
      cfg.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;

      // NULL : No handler, operates in blocking mode
      uint32_t result = nrf_drv_spi_init(&spi, &cfg, NULL);

      if (NRF_SUCCESS != result)
      {
      // error
      }

    }

    static uint8_t junk;
    static uint8_t data = 0;

    // use GPIO expander for chip select

    data = <value here>;

    uint32_t result = nrf_drv_spi_transfer (&spi, (uint8_t*)&data, 1, &junk, 1);

    if (NRF_SUCCESS != result)
    {
    // err
    }

Children
Related