Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI fails on 32-bit Zero #107

Open
barretpj opened this issue Aug 12, 2020 · 2 comments
Open

SPI fails on 32-bit Zero #107

barretpj opened this issue Aug 12, 2020 · 2 comments

Comments

@barretpj
Copy link

Board Type

Raspberry Pi Zero W

Operating System

Raspberry Pi OS Lite
Linux raspberrypi 5.4.51+ #1327 Thu Jul 23 10:53:06 BST 2020 armv6l GNU/Linux

Swift Version

Pre-built from https://github.com/uraimo/buildSwiftOnARM/releases/download/5.1.5/swift-5.1.5-armv6-RPi01234-RaspbianBuster.tgz

Description

SPI calls fail with "Message too long" regardless of the length of message.

On investigation it's because struct spi_ioc_transfer uses UnsafeMutableRawPointer for tx_buf and rx_buf, but /usr/include/linux/spi/spidev.h defines these pointers as __u64

If I add 32 bits of padding after these 2 members in to struct spi_ioc_transfer the SPI calls succeed.

@gestrich
Copy link

From testing various versions, this bugs seem introduced in v 1.1.15. Version. 1.1.14 seems ok.

@uraimo
Copy link
Owner

uraimo commented Sep 1, 2020

Thanks @barretpj @gestrich, exactly, 1.1.15 introduced this change that broke it and the fix is converting to an uint64 via bitpattern (that
actually adds a padding at the beginning if necessary), will fix/test it as soon as I can get a hold of a pi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants