arduino / arduino/ArduinoCore-mbed
SPI MISO contention
- Dominant language
- C
- Stars
- 411
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
Having a strange issue when using the SPI on the Portenta H7 to read from an ADS753. During the SPI transaction the CIPO (MISO) line is only transitioning to a 1.8V logic high. Normally I would assume that this was something on my board or the ADS7953 itself, but I've replaced the part without success, and when cutting the trace at the high density connector (J2) the CIPO (MISO) therefore only eliminating the Portenta, the signal behaves as expected with a full 0V->3.3V swing. This makes me believe that there is something I am doing wrong when configuring SPI in my sketch and causing some kind of contention.
Thanks in advance to anyone who can offer some insight!
I'm running Arduino ide 1.8.19 with the Arduino Mbed OS Portenta Boards library version 2.8.0.
Short example that causes the problem (.ino attached with scope capture of contention):
```
#include
#include
#include
void setup() {
// put your setup code here, to run once:
pinMode(144, OUTPUT);
SPI.begin();
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, LOW);
rtos::ThisThread::sleep_for((std::chrono::milliseconds)500);
uint16_t Cmd;
uint16_t nAddr = 0;
uint8_t pData[2];
for (int i = 0; i < 18; i++)
{
Cmd = 0x1000 | 0x0800 | (((nAddr & 0xF)) << 7);
pData[0] = (uint8_t)(Cmd >> 8);
pData[1] = (uint8_t)(Cmd);
nAddr++;
SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE0));
digitalWrite(144, LOW);
pData[0] = SPI.transfer(pData[0]);
pData[1] = SPI.transfer(pData[1]);
digitalWrite(144, HIGH);
SPI.endTransaction();
}
digitalWrite(LED_BUILTIN, HIGH);
rtos::ThisThread::sleep_for((std::chrono::milliseconds)500);
}
```
[sketch_jul11a.zip](https://github.com/arduino/ArduinoCore-mbed/files/9092831/sketch_jul11a.zip)

Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the attached sketch_jul11a.zip and inspect the Portenta H7 SPI setup around SPI.begin(), SPI.beginTransaction(), and the pinMode/digitalWrite calls. Reproduce the CIPO voltage behavior with the ADS753/ADS7953 setup and determine whether the Arduino Mbed OS Portenta Boards configuration is responsible; done means a confirmed cause and documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100