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

InexactError when using set_mode #13

Closed
phykos opened this issue Oct 26, 2020 · 2 comments
Closed

InexactError when using set_mode #13

phykos opened this issue Oct 26, 2020 · 2 comments

Comments

@phykos
Copy link

phykos commented Oct 26, 2020

So far, I tried changing mode on pin 1.
This is what I've got.

julia> using PiGPIO

julia> p = Pi()
[ Info: Successfully connected!
Pi("localhost", 8888, true, PiGPIO.SockLock(Sockets.TCPSocket(RawFD(0x00000012) open, 0 bytes waiting), ReentrantLock(nothing, Base.GenericCondition{Base.Threads.SpinLock}(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0)), PiGPIO.CallbackThread(PiGPIO.SockLock(Sockets.TCPSocket(RawFD(0x00000012) open, 0 bytes waiting), ReentrantLock(nothing, Base.GenericCondition{Base.Threads.SpinLock}(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0)), PiGPIO.SockLock(Sockets.TCPSocket(RawFD(0x00000013) paused, 0 bytes waiting), ReentrantLock(nothing, Base.GenericCondition{Base.Threads.SpinLock}(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0)), true, true, 0, 0x00000000, Any[]))

julia> set_mode(p, 1, PiGPIO.OUTPUT)
ERROR: InexactError: check_top_bit(Int32, 4294967255)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Type{Int32}, ::UInt32) at ./boot.jl:558
 [2] check_top_bit at ./boot.jl:572 [inlined]
 [3] toInt32 at ./boot.jl:621 [inlined]
 [4] Int32 at ./boot.jl:707 [inlined]
 [5] convert at ./number.jl:7 [inlined]
 [6] _u2i(::UInt32) at /home/g/.julia/packages/PiGPIO/bH87w/src/pi.jl:72
 [7] set_mode(::Pi, ::Int64, ::Int64) at /home/g/.julia/packages/PiGPIO/bH87w/src/pi.jl:356
 [8] top-level scope at REPL[3]:1

julia> set_mode(p, 1, PiGPIO.INPUT)
ERROR: InexactError: check_top_bit(Int32, 4294967255)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Type{Int32}, ::UInt32) at ./boot.jl:558
 [2] check_top_bit at ./boot.jl:572 [inlined]
 [3] toInt32 at ./boot.jl:621 [inlined]
 [4] Int32 at ./boot.jl:707 [inlined]
 [5] convert at ./number.jl:7 [inlined]
 [6] _u2i(::UInt32) at /home/g/.julia/packages/PiGPIO/bH87w/src/pi.jl:72
 [7] set_mode(::Pi, ::Int64, ::Int64) at /home/g/.julia/packages/PiGPIO/bH87w/src/pi.jl:356
 [8] top-level scope at REPL[4]:1

@VEZY
Copy link

VEZY commented Mar 7, 2021

I think it's because Pin 1 is not a GPIO, it is only used to provide 3v3.

Alexander-Barth pushed a commit that referenced this issue Dec 19, 2024
@Alexander-Barth
Copy link
Contributor

Yes, you cannot set pin 1 to output mode.
However, there is some issue in the error reporting. The commit 34866ff fixes the problem.
The error message is now (corresponding to PI_NOT_PERMITTED, -41):

julia> set_mode(p, 1, PiGPIO.OUTPUT)
ERROR: no permission to update GPIO
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] _u2i
   @ ~/.julia/dev/PiGPIO/src/pi.jl:77 [inlined]
 [3] set_mode(self::Pi, gpio::Int32, mode::Int32)
   @ PiGPIO ~/.julia/dev/PiGPIO/src/pi.jl:364
 [4] top-level scope
   @ REPL[16]:1

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