SPI Code Runs on Uno but not Zero

When using the statement SPI.transfer(0x70) , it runs fine on an Uno, but with a Zero it does not return and hangs. The SPI transaction is commenced with
SPI.begin().

Are there any standard modifications to make in code when moving from a Uno to a Zero?
Thanks.

have you seen this thread

Yes. In fact the last comment is "Are there any simple SPI master/slave demo sketches specifically for the Arduino Zero? ... the sample IDE examples for SPI compile only for the newer ... boards. The IDE doesn't even show any sample SPI sketches when the IDE is configured for the Zero. ..."
I have only found examples using a Uno, nothing with a Zero.

shouldn't they be the same?
isn't it just the pins that are different?

The pins same pins are used on he Zero and the Uno, namely the ICSP header for SPI. This point is addressed in more detail in the thread you linked above.

It's probably time to post your complete code. Also, tell us which version of the Arduino IDE and board package you're using.

The code is GitHub - davidjabon/LS7366: An Arduino library to interface to the LS7366 quadrature encoder counter.

The Uno & Zero are both manufactured by Arduino but I do not have access to them at the moment; however they are several years old.

Hi @RBB01 .
Remember that UNO operates SPI on 5V and zero is based on 3.3V.

RV mineirin

A TXS0108E logic level converter was employed in the circuit.

Hi @.
The image below was extracted from:

Note that the SPI I/Os to pins 9, 10, 11, 12, and 13, marked in blue, are different from the ICSP connector I/Os, marked in green.

RV mineirin

[quote="RBB01, post:5, topic:883159, full:true"]
The pins same pins are used on the Zero and the Uno, namely the ICSP header for SPI. This point is addressed in more detail in the thread linked above. [/quote]

I will not be able to check the version of the boards for several hours.

My version request was for the IDE and board package, not the hardware.

I don't have a Zero, but I do have an Adafruit M0 Feather. It uses the same SAMD21 processor chip and the same I/O pins on that chip for the SPI interface. The code below works as expected with no "hangs". The Serial output and logic analyzer traces are also as expected.

BTW, Adafruit has a Tutorial that explains in detail how to instantiate additional serial-type interfaces (including SPI) on other pins using the available SAMD21 SERCOMs.

#include "Arduino.h"
#include <SPI.h>

SPISettings settings(3000000, MSBFIRST, SPI_MODE0);

void setup() {
	SPI.begin();
	Serial.begin(115200);
	delay(1000);

	Serial.println("Starting Byte Transfer Over SPI");
	SPI.beginTransaction(settings);
	SPI.transfer(0x70);
	SPI.endTransaction();
	Serial.println("Completed Byte Transfer Over SPI");
}

void loop() {
}

Serial Port Output:

Starting Byte Transfer Over SPI
Completed Byte Transfer Over SPI

Logic Analyzer:

I thank you for taking the time to test this and I will provide an update soon. The board package is 1.8.11.

I used the Adafruit link a few years ago to have an additional UART but it was helpful to have pointed out that it applies to SPIs as well.

Hello
I moved onto an ESP32 and SPI appears to work OK there, so I will not pursue the Zero further.
Thanks for your help.