SPI Transfer with MCP 2515

Currently working on interfacing a NRF52832 with a MCP 2515 to update attributes on a CANBUS from bluetooth using a SPI bus. I am currently stuck trying to set up the MCP 2515 chip. I have the spi initialized with the correct pins that I am using. However, when I go do my first spi transfer, I get stuck in this loop. Any ideas why this may be happening? The SPI transfer is just hanging

void mcp2515_reset()
{
    mcp2515_select();
    uint8_t m_tx_buf[1] = {MCP_RESET};
    uint8_t m_length = sizeof(m_tx_buf);
    
    spi_xfer_done = false;
     ret_code_t err_code;
    err_code = nrf_drv_spi_transfer(&can_spi, m_tx_buf, m_length, NULL, 0);
    APP_ERROR_CHECK(err_code);

    while (!spi_xfer_done)
    {
    if (nrf_sdh_is_enabled())
        {
            sd_app_evt_wait();
        }
        else
        {
            __WFE();
        }
    }

    mcp2515_unselect();
}

Parents Reply Children
No Data
Related