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

MCP2515 with NRF51-DK

Hi,
I am trying to interface MCP2515 with nrf51-dk. MCP2515 talks over SPI, so I have taken SPI_master as my base code. I have used MCP with arduino, so I thought it would be best to modify that library which can be found here.
But when I'm trying to configure it, it is not giving correct data. So, I have following questions:

  1. Are the pins on the DK 5V tolerant? I haven't tried to give 5V signal, thinking it might get damaged.
  2. I'm supplying power to MCP using VDD of the board which provides around 2.9V when connected via USB. Will it damage the DK as I don't know how much current MCP will draw, although it works fine with arduino 5V.
  3. I've also changed the default SPI pins to my own as the Product Sheet states that the SPI pins are not fixed. I hope its alright. I'm using the following configuration:

SCK->4, MISO->2, MOSI->3, SS->1

  1. When I do spi_send_rcv, the received data is the previously buffered data or data according to the current command?
  2. Finally the last question, can someone help me debug the code or give me hints on how to?
    I've used RTT to debug the code, and I am now stuck at a point, I know where the issue is but I'm unable to figure out what to do with that? If someone needs more details, I can provide that too. Till then I'll refrain from making this post messy. I'm attaching the code if it can help.
    I apologize if the question is too much specific. I've been at the same position for over a week. Thanks in advance for the help :)
    spi_master.zip

Edit: When I don't write the rx_buf from spi_send_rcv to RTT terminal, application doesn't get into the function spi_send_rcv after 3 times. I think this is related to some memory issue, what can I do regarding this, as most of the times rx_buf is of no use to me. I tried replacing it with NULL but no success.

Related