Comments (5)
I'm kind of confused here, sorry. Are you saying the SDK is inverted, or this core is? And if it was inverted wouldn't there be serious trouble communicating with a wide array of devices?
The logic for converting from Arduino modes to SDK modes is here:
arduino-pico/libraries/SPI/src/SPI.cpp
Lines 47 to 75 in c4f3617
Looking at those 2 switch
es and the Wikipedia article, the values themselves seem to be correct.
The actual values are set in beginTransaction
, just as in your SDK code:
arduino-pico/libraries/SPI/src/SPI.cpp
Lines 193 to 194 in c4f3617
from arduino-pico.
The conversion of the Arduino core / library from SPI mode to CPOL and CPHA is correct, what I'm saying is that SPI Mode 0 (equates CPOL = 0, CPHA = 0) should have a clock idling LOW (per wikipedia), but is actually idling HIGH on real hardware. It's as if the RP2040 chip has inverted SCLK idle levels for CPOL = 0 / 1.
Both the Arduino core and the Pico-SDK functions exhibit SCLK idle level = HIGH when both are correctly asked for SPI Mode 0 / CPOL=0, CPHA=0, when Wikie says it should be LOW.
from arduino-pico.
Ah, gotcha. Maybe this would be better handled at the Pico-SDK repo or the Raspberry Pi forum?.
Looking at the chip docs, they do show the clock low during idle for CPOL=0 (SPO=0)
and high during idle for CPOL=1: (SPO=1)
The SSPCR0
register has the 2 bits for CPOL/CPHA, and I see nothing else related to clock polarity elsewhere.
from arduino-pico.
You're right, issue in pico-sdk opened per above.
from arduino-pico.
Closing here, being followed up on (hopefully) in the SDK repo...
from arduino-pico.
Related Issues (20)
- Feature Request: dmadison ArduinoXInput support HOT 1
- FYI: Build on Windows HOT 4
- Flashing settings for Listfiles-USB - Docs HOT 4
- Version 3.8.0 Compiler Error HOT 1
- I2S Right Channel is One Sample Shifted in Time from Left HOT 1
- Feature Request: Integration of class MacAddress from arduino-esp32? HOT 2
- Fix enum redeclaration issue when using WiFi and Ethernet HOT 14
- WiFiServer and FreeRTOS - Repeatedly accepting connection eventually causes freeze HOT 4
- Joystick library - please update submodule HOT 1
- LittleFS file not opening on Pico HOT 3
- Question: What limits lwip usage within a FreeRTOS environment to setup/loop and not tasks?
- When using platformio, earlephilhower-based firmware doesn't run after reboot-to-bootloader (but does after hard BOOTSEL+RESET) HOT 4
- Hang with Pico W when using a W5500 and WiFi at the same time.
- SdFat speed regression (because of pico SPI driver change) HOT 5
- Fix for Linux hanging on PICO switching to storage mode for upload HOT 4
- Feature Request: Ability to change bluetooth device name from SerialBT
- Bluetooth reconnect fails HOT 1
- Error compiling A2DPSink
- New sketch not running with Arduino IDE OTA (Rpi Pico W) HOT 7
- PICO W STUCK DUE TO FLASH CORRUPTION. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-pico.