Recent

Author Topic: Emulating Raspberry Pi GPIO on Linux Mint PC  (Read 3665 times)

BosseB

  • New Member
  • *
  • Posts: 45
Emulating Raspberry Pi GPIO on Linux Mint PC
« on: February 29, 2016, 08:58:37 am »
I am working on a data acquisition controller targeting Raspberry Pi2 hardware.
I have installed FPC/Lazarus on a Pi2 unit so I can program and build/debug there, but the platform is rather limited in performance so I have followed advice to move to a Linux based development system instead.
So now I have duplicated the installation on a Linux Mint 17.3 MATE virtual computer on my Win7X64 laptop using VMWare Workstation 12PRO.

What I would like to discuss is how I could handle the hardware differences between a Pi2 (ARM7) and a virtual PC environment.
Specifically I need to use the GPIO on the RPi2 in order to switch on/off power and similar things on the actual target hardware.
So I have tested this on the RPi2 platform and the GPIO manipulations work just fine from Lazarus using the PiGpio unit (after I patched it for the register address differences between the original RPI and the RPi2).

Now I would like to have some way to make FPC/Lazarus use the GPIO on the physical system if running on a Pi2 hardware but otherwise redirect to some kind of GPIO emulator if not on an RPi2.

Has this been done before and if so how was it accomplished?
For development/test/debug I will not need physical signals, but I need to make sure that the code will compile on an RPi2 platform so it will actually use the GPIO.
During development it is sufficient if I can see the states of the GPIO outputs and toggle the inputs, possibly in some simulation window or such.

--
Bo Berglund
Sweden

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: Emulating Raspberry Pi GPIO on Linux Mint PC
« Reply #1 on: February 29, 2016, 10:38:23 am »
It should not be very difficult to write a Daemon that simulates the GPIO, but rather than ask here ask on  the Raspberry Pi forum if something like that is already available (in any language).
I would be interested in writing one, but I am notoriously lazy in doing it from scratch.
also related to equus asinus.

BosseB

  • New Member
  • *
  • Posts: 45
Re: Emulating Raspberry Pi GPIO on Linux Mint PC
« Reply #2 on: February 29, 2016, 11:07:40 am »
I did post a question there but probably in a too obscure place... (Programming/Other)
Somehow it seems like the GPIO simulator/emulator is only needed if one programs on a different platform than the RPi and therefore the RPi forums might not be such a good place. They seem not to know much about Pascal there for example.
OTOH in other forums they probably know nothing about the Raspberry Pi instead....
--
Bo Berglund
Sweden

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: Emulating Raspberry Pi GPIO on Linux Mint PC
« Reply #3 on: February 29, 2016, 11:16:36 am »
It should be in "Bare metal".
also related to equus asinus.

BosseB

  • New Member
  • *
  • Posts: 45
Re: Emulating Raspberry Pi GPIO on Linux Mint PC
« Reply #4 on: February 29, 2016, 11:38:40 am »
Thanks, I asked the admins to move the thread.
--
Bo Berglund
Sweden