bjones
Hi I'm new to OpenPLC. I setup it up on a Pi 3+ and everything worked fine. I decided to step it up and run it on a compute module. I have a CM3+ on a Compute Module IO Board from Waveshare RB-Wav-134. I have tested the CM on the IO board and it works as expected. When I start OpenPLC using the same setup I used on the Pi 3+ it does not work. Rather than spend a lot of time going in circles I though you could give me some suggestions as to where to start looking.
Quote 0 0
thiagoralves
Define "it does not work".

If the problem is related to pin mapping, it might be needed to change the OpenPLC Raspberry Pi driver to properly control the GPIO since the CM3 uses different IO pins than the Pi board, 
Quote 0 0
bjones
So this is the pin mask in the raspberrypi.cpp file? 
Quote 0 0
thiagoralves
Yes. But this pin mask is from WiringPi. I don't even know if WiringPi supports CM. If it doesn't, then it's game over. We need a new driver from scratch.

But again, define "it does not work". I'm assuming this is the problem, but it could be something else. What happens when you launch it? Does it run? Does it crash? Any error messages?
Quote 0 0
bjones
When I load my program my outputs go high and it does not read the inputs. According to the wiringPi website it looks like it should work. I will do further testing to see if I can figure out what is going on. 
Quote 0 0
bjones
I got it working, I had some wiring issues from when I was using my test rig for some other testing. With that done I was able to remap the IO to match my Compute IO board that adds a total of 45 IO points. However, I found a couple of things. One is that WiringPi GPIO 5 does not work, I cannot make it change state as an input or and output. I can make it work fine using python.
Second is that I cannot access anything over IO point 27, I can access all points with the gpio command.
Quote 0 0
thiagoralves
That’s what I imagined. WiringPi was made for the Pi board, and it seems that it can only address the board pins. 
Quote 0 0
bjones
I thought the gpio command was built on wiringPi.
Quote 0 0
thiagoralves
It is, but maybe there is something different on the API for C. Have you googled about wiring pi and the compute module? If that's a no go, then maybe an option would be to write a driver around the gpio command-line utility. You can use system() or exec() to call the gpio utility
Quote 0 0
bjones
I was thinking along those lines but want to see if you had any more tricks up your sleeve. I'll give that a try and see how it goes. I'll keep you updated.
Quote 0 0
thiagoralves
Have you seen this ( http://wiringpi.com/wiringpi-and-the-raspberry-pi-compute-board/ 😉 and this ( http://abyz.me.uk/rpi/pigpio/ 😉? As I usually say, Google is your friend. Good luck.
Quote 0 0
bjones
I saw the first link and that is what got me to thinking about using the compute board. I had not seen the second link it looks promising. I will get that a try for sure and I'll let you know how it goes.
Quote 0 0
bjones
I just tried pigpio and it works perfectly. I have access to all gpio pins on the compute module. I will do testing to make sure it all works as expected.
Quote 0 0
thiagoralves
That’s great! Let me know if you’re able to craft a driver for the compute module.
Quote 0 0