-
Notifications
You must be signed in to change notification settings - Fork 17
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
[BUG] Cannot Open SPI Interface #18
Comments
I have also seen this problem while looking at the issue: There are some changes in the i2c branch, in particular: I just merged the i2c branch into the master, since the problem also affects spi as your example shows,. Can you re-try with the master branch? I don't know the details of the history of this code, but it was converted from the python code. Probably only a subset of the pigpio.py functionality was ever tested. Rather than looking at old julia version, it might be easier to find the issue by looking at the python code. |
Not to say that the code wasn't always buggy, but this code is prehistoric. From the first commit, I see a comment saying |
I have good news! This now appears to work! julia> using PiGPIO
julia> p = Pi()
[ Info: Successfully connected!
Pi("localhost", 8888, true, PiGPIO.SockLock(Sockets.TCPSocket(RawFD(17) open, 0 bytes waiting), ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (0, 0, 0))), PiGPIO.CallbackThread(PiGPIO.SockLock(Sockets.TCPSocket(RawFD(17) open, 0 bytes waiting), ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (0, 0, 0))), PiGPIO.SockLock(Sockets.TCPSocket(RawFD(18) paused, 0 bytes waiting), ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (0, 0, 0))), true, true, 0, 0x00000000, Any[]))
julia> h = PiGPIO.spi_open(p, 1, 100000, 0)
1 And oh my gosh @aviks -- I had no idea it was that old 😱 I'll take your advice as well regarding the original Python code @Alexander-Barth! |
Hi @Alexander-Barth and co,
Carrying on from a discussion from Discourse, the merge b48be39 did help me get a bit further with opening an SPI interface, but I am still receiving an error:
After debugging, I can observe that the error occurs within this PiGPIO.jl function:
PiGPIO.jl/src/pi.jl
Lines 115 to 138 in e34746d
In particular, I know it is this loop:
As it is trying to iterate over a
IOBuffer
-- but I am unsure what it is trying to actually do or access. I tested old Julia versions starting from 1.0 and I have concluded this is just buggy code. There was not a point in time post-1.0 Julia that I could find which allows iteration over an IOBuffer.Any thoughts here? Thanks!
~ tcp 🌳
The text was updated successfully, but these errors were encountered: