spi_set_format does not update the clock polarity until after a read or write #868
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#868
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Corrected code in spi.h
I also encountered this on a Mode 3 device (Analog Devices accelerometer). Code above is also discussed here: https://forums.raspberrypi.com/viewtopic.php?t=336142
This looks related to #713. I submitted a pull request which should work for this also. (#1158)
Sounds like this was actually fixed in 1.5.0; please reopen otherwise
Hi @kilograham , I find the same issue with spi slave mode0. I use raspi 4 as spi master. I try the latest pico sdk master&develop branch but the issue still here. spi slave mode1 is fine.
Please give the SDK version in use?
I use the latest github version of the pico-sdk, both master and develop branch has the same issue.
(I see the submit which @daveythacher mentioned above is merged into develop branch so I also try this branch )
Is this relevant? I would recommended filing SPI slave issues independently.
Overall I noticed ARM SPI is a little different. Also the SDK interface is mostly based on master mode. Not all SPI hardware features are available in the SDK. I view the SDK methods as helpers rather than a complete API.
Did you try this? (The order could matter.)
Edit:
Any objection to an enable method? That is the only thing spi_init actually does.
Yes, I just modify a little the pico-example/spi/spi_master_slave/spi_slave.c as below:
This is mode1 which work fine. But if I comment the line 64 or modify line 64 as
The mode0 will not work.
I also check this but it just say it should be a sdk issue because the arduino-pico lib is just a encapsulation of the pico-sdk I think.
I haven't capture the waveform. But the mode0 behave no matter how many the master clk one time, the slave only return one correct byte one time in the first 8 bit clk position, then the slave return the next one correct byte when I use spi master to send again.
The correct behave of the spi slave example demo should be that it will return
BUF_LENbytes in one time. That also what happen in mode1.I am thinking this is a different issue. Please verify the CS line.
bump @peterharperuk is this fixed?