Hi DevZone,
I am modifying an CAN library for nRF52840 preview DK. In my project, nRF52 preview DK is working as a SPI master and Arduino CAN Bus Shield is working as a SPI slave.
Before starting test with Arduino CAN Bus shield, I test it with an Arduino UNO board, a simple Arduino SPI slave program is run on the Arduino UNO board.
It seems the Arduino UNO board correctly receive the data from nRF DK, but nRF DK could not receive the response from Arduino UNO.
In nRF52 DK program, function mcp2515_readStatus(void) is is called periodically,
where spi_send_recv() is defined as:
In Arduino UNO, the SPI slave code is as below:
When I run nRF DK and Arduino the log is as below:
nRF 52 DK log:
tx data A0
Transfer Complete!
rx data 0
tx data 0
Transfer Complete!
rx data 0
The Arduino log:
***Slave Enabled.
Initial -1 slave response code sent
rx:160.
Slave Disabled.
***Slave Enabled.
Initial -1 slave response code sent
rx:0.
Slave Disabled.
My questions are:
1) Could you please help find the reason causing nRF52 DK cannot receive the response from Arduino? I have check the connection cable, there is no problem...
2) Does nrf_drv_spi_transfer function automatically set SS PIN when it is called? From Arduino log, I find the SS PIN is disable and enable for every time nrf_drv_spi_transfer function is called...
The real scenario looks like: SS enable (set Low)-> SPI Master send 0xA0 (DEC: 160) ->SS disable(Set High)->SS enable(Set Low) -> SPI Master send 0x00 -> SS disable(Set High),
But the scenario I expect is: SS enable (set Low)-> SPI Master send 0xA0 (DEC: 160) -> SPI Master send 0x00 -> SS disable(Set High).
How can I realise the scenario that I expect?
Thanks