Hello Everyone,
I see lots of great examples out there of how to control all sorts of hardware under PYNQ using Jupyter Notebooks.
How can I control something seemingly very simple like PS MIO GPIOs from a Jupyter Notebook?
Thanks,
-Kevin
Hello Everyone,
I see lots of great examples out there of how to control all sorts of hardware under PYNQ using Jupyter Notebooks.
How can I control something seemingly very simple like PS MIO GPIOs from a Jupyter Notebook?
Thanks,
-Kevin
Well after searching around for a while and getting some information from Mario B and Fred K, I compiled a Jupyter Notebook to help illustrate how this all works:
https://github.com/zedhed/ultra96
Long story short, you have to export a particular GPIO so that a control for it appears within sysfs under the /sys/ folder.
Here are the shortcut commands to control the MIO45 that I wanted to use:
# Find out what you have for GPIO controllers (I have seen numbers change quite a bit from one Linux kernel release to another) ls /sys/class/gpio/ # Export controls for the specific GPIO that you want to use, after you translate the MIO45 number to logical Linux GPIO number (in this case it is 338 + 45 = 383) echo 383 > /sys/class/gpio/export # Set the MIO controller to operate in the output mode echo out > /sys/class/gpio/gpio383/direction # Next try setting the output state to logic high echo 1 > /sys/class/gpio/gpio383/value # Finally, try setting the output state back to logic low echo 0 > /sys/class/gpio/gpio383/value
Please read through the ultra96/ultra96-gpio/ultra96_control_ps_mio_gpios.ipynb Notebook for a much more thorough writeup on this topic.
Best Regards,
-Kevin
kevinkeryk This is the same way to handle GPIO under the Raspberry Pi except where it is located in the tree since the pin numbers are different...
Thanks for the pointer.
Clem
Thanks clem57! It seemed like the information should be more accessible, so I did the writeup. I didn't realize it was the same for Raspberry Pi, I need to spend more time experimenting with mine.
Have a safe and happy holiday season!
-Kevin
Thanks clem57! It seemed like the information should be more accessible, so I did the writeup. I didn't realize it was the same for Raspberry Pi, I need to spend more time experimenting with mine.
Have a safe and happy holiday season!
-Kevin