On AMB82 MINI, SPI1 MISO (Pin 0 / PF5) always reads 0x00, no matter what data is sent on MOSI. Because of this, hardware SPI communication with peripherals does not work.
Hardware / Software
Board: AMB82 MINI (RTL8735B)
SDK: Realtek Ameba Boards 4.0.9
SPI1 pins:
MISO: Pin 0 (PF5)
MOSI: Pin 2 (PF7)
SCLK: Pin 1 (PF6)
Tests and Observations
Loopback test
MOSI (Pin 2) was physically connected to MISO (Pin 0).
Sending 0xAA always returns 0x00.
This suggests that SPI1 MISO is not actually receiving data.
Pinmux conflict
When initializing SPI1, the following error appears:
[MISC Err] Pin 5[5] is conflicted
[MISC Err] It's using by peripheral F0000000
[SSI Err] PIN a5 cannot be registered.
What was tried
Loopback test (confirms MISO issue)
Removing CS pinMode before SPI.begin()
Setting pinMode(0, INPUT) before SPI1.begin()
Testing SPI0 (MISO on Pin 14) — same result
Disabling FreeRTOS interrupts
Minimal SPI initialization code
All cases behave the same: MISO always returns 0x00.
Current workaround
Software SPI (bit-banging) works reliably, but hardware SPI is preferred for performance and stability.
Questions
Is SPI1 MISO on AMB82 MINI actually supported and usable?
What peripheral is occupying PF5 (shown as F0000000)?
Is there a known fix or recommended workaround for this issue?
The error looks identical to the one before, does your fix for SPI0 not work for SPI1 too? If not, please share what you did to fix your issue with SPI0 so we can try other methods to figure out the problem better.
Meanwhile please give our SPI example a try and check if your SPI0 and SPI1 are working as intended. You can find it within {SDK}\project\realtek_amebapro2_v0_example\example_sources\spi_master_write_read_one_byte\src\main.c", this sets SPI0 as slave and SPI1 as master.
I have also compiled and ran the example with SPI0 as master and SPI1 as slave instead. The example worked both times when SPI0 is connected SPI1 and when both SPIs’ looped back to themselves as in your loopback test.
Hi, Thank you for the example. I understand the FreeRTOS SDK approach.
However, Arduino IDE uses different API (`SPI1.begin()` vs `spi_init()`) and **SPI1 MISO still returns 0x00** in Arduino IDE, even after removing CS pinMode before SPI.begin().
— Can we use FreeRTOS SDK SPI API (`spi_init()`, `spi_format()`) from Arduino IDE, or should we switch to FreeRTOS SDK?
Sorry it slipped my mind to keep it within Arduino. Rest assured you will be fine sticking with our Arduino SDK as we have designed it to be identical to our FreeRTOS’s SDK. I have converted the example to a simpler one to be used with the ArduinoIDE. Please test it with your AMB82-Mini and let me know how it goes!
Master SPI0 and Slave SPI1. The loopback test should pass for both sides too.
#include <SPI.h>
void setup() {
Serial.begin(115200);
delay(2000);
Serial.println("=== SPI1 Test on AMB82 MINI ===");
Serial.println("Initializing SPI0 and SPI1");
SPI.begin(SPI_MODE_MASTER);
SPI1.begin(SPI_MODE_SLAVE);
Serial.println("SPI0 and SPI1 initialized");
Serial.println("Begin Slave Send and Read");
SPI1.slaveWrite(0x44);
uint8_t masterRead = SPI.masterWrite(0x55);
Serial.print("masterRead: 0x");
Serial.println(masterRead, HEX);
uint8_t slaveRead = SPI1.slaveRead();
Serial.print("slaveRead: 0x");
Serial.println(slaveRead, HEX);
}
void loop() {
delay(1000);
}
Sorry, Hi, I tested the SPI loopback code you sent but it’s not working. I connected the pins as required (SPI0_MOSI to SPI1_MISO, SPI0_MISO to SPI1_MOSI, SPI0_SCLK to SPI1_SCLK) but the test fails.
Expected masterRead 0x44 and slaveRead 0x55, but got masterRead 0xFF and slaveRead 0x0. Looks like SPI1 slave mode isn’t working properly or the slaveWrite/slaveRead methods have issues.
I see! The MOSI and MISO pins must be connected to each other as in SPI0_MOSI ↔ SPI1_MOSI and SPI0_MISO ↔ SPI1_MISO. Please try the example again after adjusting the pin connections. The output should look like this:
=== SPI1 Test on AMB82 MINI ===
Initializing SPI0 and SPI1
SPI0 and SPI1 initialized
Begin Slave Send and Read
masterRead: 0x44
slaveRead: 0x55
If that still does not go as expected let us test for other potential issues.
Please try the same example but with the SPIs’ MISO and MOSI connected to themselves.
(eg. SPI1_MISO ↔ SPI1_MOSI) You should be getting an output that looks like this.
=== SPI1 Test on AMB82 MINI ===
Initializing SPI0 and SPI1
SPI0 and SPI1 initialized
Begin Slave Send and Read
masterRead: 0x55
slaveRead: 0x44
Test the set of SPI pins (PF5, PF6, PF7, PF8, PE4, PE3, PE2, PE1) to verify that they are still working. You can use a multimeter, use them to blink an LED or any method convenient for testing.
If you are using an early release build then try using a stable version of the Arduino SDK - Version 4.0.9 and see if that helps with your project.
— oh, thank you! Hardware SPI Success with ADS1256
I wanted to share a success story and solution for using Hardware SPI with external devices (ADS1256) on AMB82-MINI.
I was trying to connect ADS1256 (24-bit ADC) to AMB82-MINI but couldn’t get Hardware SPI to work. The test with SPI0 ↔ SPI1 (cross-connection) worked perfectly, but reading from ADS1256 always returned 0x00.
The key was using **`beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE1))` before `masterWrite()`**.
Special thanks to the forum moderator for the SPI0 ↔ SPI1 test example and quick support. The cross-connection test helped confirm that Hardware SPI works on AMB82-MINI, which led to finding the solution for external devices.