This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf52 SPIM no MISO response

Hi,

Im trying to connect MCP25625 via SPI on nrf52. I checked with the scope that CS, MOSI and SCK are correct, but I get no reply on MISO line whatsoever. I perform a very easy operation:

  1. Reset - send 1 byte data
  2. Read register - send 3 bytes.

Any ideas what to check? i have 2 custom boards and they both have the same issue.

image description OSC2 waveform

image description 3-byte command bitbanging SCK and MOSI lines

  • How did you configure your SPI? What pin are you using for MISO?

  • just a standard config:

    #define NRF_DRV_SPI_DEFAULT_CONFIG(id)                       \
    {                                                            \
        .sck_pin      = CONCAT_3(SPI, id, _CONFIG_SCK_PIN),      \
        .mosi_pin     = CONCAT_3(SPI, id, _CONFIG_MOSI_PIN),     \
        .miso_pin     = CONCAT_3(SPI, id, _CONFIG_MISO_PIN),     \
        .ss_pin       = NRF_DRV_SPI_PIN_NOT_USED,                \
        .irq_priority = CONCAT_3(SPI, id, _CONFIG_IRQ_PRIORITY), \
        .orc          = 0xFF,                                    \
        .frequency    = NRF_DRV_SPI_FREQ_4M,                     \
        .mode         = NRF_DRV_SPI_MODE_0,                      \
        .bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,         \
    }
    

    MISO is using GPIO 11 Tried enabling and disabling EASYDMA, didnt change anything

  • If you have good MOSI, SCK and CS signals and you actually can see them going into MCP module, there is something wrong with MCP module. Maybe it is not powered correctly, reset pin is not pulled or something.I wouldn't search for problem on nrf52 side if it works ok. Or you just send wrong commands.

  • I've used the older version of the 25625, I had no extra pullups or anything like that. All the pins ran straight to my micro.

    That said... A LOT of SPI devices don't have proper tri-state on the MISO line. It's frustrating.

    Remember that many SPI devices won't reply to a command until the NEXT attempt to read/write to it. I can't remember anything about the MCP part's SPI protcol, but you may need to release chip select and re-engage before you'll get meaningful data.

    Another way to eliminate the possibility of the nRF52's setup being wrong... Turn the GPIO to input/float and not SPI function and re-scope. You want to make sure you aren't stuck in an open drain mode or something like that. Also and likewise, if possible maybe you can physically unhook the MISO line and scope with it not connected to the nRF52.

    Of course this is all assuming the MCP is "on". Something I'd recommend for debugging like this is to bit bang out that first SPI message. Take the nRF52's peripheral and setup out of the equation.

    Good luck - SPI MISO errors aren't fun.

    Test:

    1. Put a pullup on the MISO line.
    2. Send a command, release SS, send a read command
    3. Isolate the nRF52 out of the system by bit banging a test command or disconnecting the trace
  • Hi, I followed your advice and did the bitbanging. The thing is that to reset the chip first command has to be 1 byte only and nrf52 has problems with it. So I sent 1 byte command and then 3 byte reading register. Unfortunately without any luck. Ive attached 3-byte command and the OSC2 waveform which seems a bit weird to my original message. What do you think, am I missing something?

    CS line works as well, its just i have only 2 inputs.

Related