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

SPI communication failure between nRF52840 Preview DK and Arduino UNO

Hello DevZone, 

I am doing a simple test for SPI communication between nRF52840 DK(SPI master) and Arduino UNO(slave). 

The Nordic program is based on SDK 14.2.0 spi example, I only change the TEST_STRING from "Nordic" to "N" and PIN number according to Arduino PIN map.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and a Arduino slave example code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// what to do with incoming data
volatile byte command = 0;
int select_slave = 0; //1: selected, 2: not selected
void setup (void)
{
Serial.begin (9600);
Serial.println ("This is SPI slave test");
// have to send on master in, *slave out*
pinMode(MISO, OUTPUT);
// turn on SPI in slave mode
SPCR |= _BV(SPE);
// turn on interrupts
SPCR |= _BV(SPIE);
} // end of setup
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

As I set SPDR to the value Arduino received, what I expect is Nordic should receive the same value it send to Arduino...

The result is: Sending data from Nordic to Arduino seems OK. However, Nordic receives the strange response... 

Is it possible to test my sample code in your side? Very appreciate if you can verify my test sample and find the root cause of the problem.