Jump to content

Recommended Posts

Posted (edited)

Hello !

I'm trying to make DuetSoftwareFirmware (software to control 3D printers boards using a SBC) working on a OrangePi4B using armbian (The software works well on raspberry pi 3 and 4).


It use a SPI interface for data transfer between SBC and the board as well as an extra pin "data transfer ready".


I use the pin 22 on the connector for "data transfer ready".
This pin is mapped to GPIO1_D0. So GPIO pin number is 56 ( 1 * 32 + 3 * 8 + 0).

 

For now, I'm getting errors because it seems like the pin can't be set into event mode.
Below is the part of the source code (it can also be seen here)
 

 // Set up the pin
gpioevent_request tr = new gpioevent_request
{
  line_offset = (uint)pin,
  handle_flags = (uint)GpioHandleFlags.GPIOHANDLE_REQUEST_INPUT,
  event_flags = (uint)GpioEventFlags.GPIOEVENT_REQUEST_BOTH_EDGES,
};

[...]

int result = Interop.ioctl(_deviceFileDescriptor, GPIO_GET_LINEEVENT_IOCTL, new IntPtr(&tr));
if (result < 0)
{
  throw new IOException($"Error {Marshal.GetLastWin32Error()}. Cannot put line into event mode.");
}

 

Is the GPIO event mode also available on RK3399 or is it a feature of BCM chipsets ?
If available, what do I need to do to activate it ?

 

Maybe the device file descriptor is not as the same location as RaspberryPi ?


I know interrupts could be as well used but it would implies to change the software and obviously, I would like to avoid this.
 

Thanks !

BTW: How to increase the number of posts per day ? I'm new on this forum and it's probably an anti-spam feature but I couldn''t even reply to this thread.

Edited by Falcounet
<
Posted (edited)

Well, in fact, It might just be a misconfiguration of the software.

How to find in which /dev/gpiochipX (or /sys/class/gpio/gpiochipX ) offset and line number the pin 22 on the GPIO header (GPIO1_D0) is refering to ?
I can't understand how to sort out this information from the RK3399 datasheet.

Edited by Falcounet
Posted

I would start with the OrangePI's documentation, and see if they have a table somewhere on a wiki.

 

You can also look at the kernel interface: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

 

You might find more via "sudo gpio readall" or looking at "/sys/kernel/debug/gpio" on your board.

 

Other vendors have RK3399 examples, which may also be useful: http://wiki.friendlyarm.com/wiki/index.php/WiringPi_for_RK3399#Test

 

Failing that, you may have to flip some pins and see what changes with a LED or multimeter: https://www.ics.com/blog/gpio-programming-using-sysfs-interface

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines