I’ve just got a duo for low level programming and operations.
I took a look to the wiringx library but I saw that the binary is only given (libwiringx.so) and not the sources with the specific adaptations for the duo. Is it possible to put the sources of the modified wiringx version ? I am really interested to understand how it works at lower level.
The datasheet shows how GPIO works at a low level. Search it for
GPIO_SWPORTA_DR (page 536). Is that what you need?
Thank you. That’s it ! I saw the adress space and registers.
However, it is mentionned that 4 group of GPIO exists. I can’t understand from the document what it actually means. I guess the GPIO pins of the milk-v duo are mapped to the GPIO0 (base adresse : 0x03020000).
My understanding is that GPIOs are split into multiple ‘ports’. Each port has 32 GPIOs. So if you wish to (say) control the LED on GPIOC24 you would use GPIO2 base address.
The above example blinks the on-board LED 5 times.
That’s clear, thank you for the information and the code.
I tried similar code and, then, the example above.
I have both a segmentation fault. The OS seems to prevent direct access to this addresses.
Should I use mmap() ?
That code came from FreeRTOS (the “little” core). Under Linux you would probably need a kernel module or use the existing GPIO subsystem.
The source code of wiringX will be made open-source, and we are preparing to submit a pull request (PR) to the wringX’s repository.
Hello ewp and Carbon,
I’ll take a look to FreeRTOS when I have time.
And I would also be interested to look at the wiringx code.
For the moment, I’ll simply use digitalread and write…