-
Notifications
You must be signed in to change notification settings - Fork 51
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 Hardware driver - spidev #120
Comments
Sounds good David, I'm definitely interested in this :) |
Hi David - I've been having a look at this. I've hit an issue I wondered if you could help with? I successfully managed to swap out the software driver for the bcm2835 driver, but there was an issue in that it needed root to execute. So I am now trying to use spidev (C kernel library version). The issue I have is that I can't read the register values, I always seem to be getting 0 back... Is there anything special I need to do between Tx of the address and the Rx of the response? bcm2835 version (working):
spidev version:
Called with HRF_readreg(HRF_ADDR_VERSION); (radio version) it just returns 0 instead of 36. output:
|
Hmm, nothing obvious wrong. Is spifd set correct, what does SPI_IOC_MESSAGE(1) bind to, is that correct? Max clock of rfm69 is 10MHz, that should be fine Have you pulsed reset to get the radio into the correct initial state? Is the polarity of CS correct? Is the SPI mode PHA and POL correct? This might also help... https://github.com/OnionIoT/python-spidev Do you need cs_change 1 or are you doing cs external to send? Do you have a scope of logic analyser to get a trace of the transaction? |
So on initial inspection it looks like CS is set to CS_HIGH at the moment, looking at the HopeRF specs, NSS (aka CS) should be set LOW at start and HIGH at the end. Now the weird thing is, that I'm not setting CS_HIGH by the spi mode command:
Outputs:
I believe 4 means (see: https://github.com/spotify/linux/blob/master/include/linux/spi/spidev.h): Can you confirm that CS should be set this LOW? If so, I Might have to get the linux kernel guys involved here! |
Follow-up: I've fixed it by switching to /dev/spidev0.1 (from /dev/spidev0.0) although it seems to be working the opposite way to expected to me. |
I have been experimenting with the spidev device driver tonight on a pi, with good results.
https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
I might make the SPI auto detect and use an spidev instance, and fall back to softspi if it can't find it.
This will increase turnaround performance in challenging use cases like eTRV.
The text was updated successfully, but these errors were encountered: