Gateway app /serial port not running

Started by frix, October 01, 2017, 07:51:23 PM

frix

Hi Felix,

Super noob here. A few years back I bought an RPi (B) with all the excitement in the world just to put it away like most people I know. Finding moteinos and the gateway app finally gave it some purpose, so I've been working on setting my gateway all weekend.

I got a fresh install of the latest raspbian with NOOBS (downloaded 09/31/17), and got the gateway with your script. Everything looked peachy but I can't get the app to work. It gets stuck in the "waiting for socket" state and just won't get past it.

Right now I'm testing the system with a gateway mote connected to ttyAMA0 and another mote with the weather shield. I just confirmed it's all working fine by reading some serial with minicom.

I'm not that versed on Linux, so I really don't know how to check if the gateway process is running or not, but looking online I found two commands:

systemctl

and didn't see the gateway there.

then ran
ps aux | grep gateway

and I get:
pi         929  0.0  0.9   4368  1808 pts/0    S+   19:46   0:00 grep --color=auto gateway


If I look for any Log in the /gateway folder I can't seem to find any log file so I don't have any error to look at/report.

I think the app is not running. Any pointers?

Thanks!
Oscar

Kilo95

make sure that you run

sudo raspi-config

and disable the serial console but leave the serial adapter enabled and reboot


you can then run:

sudo apt-get install minicom

minicom -b 19200 -o -D /dev/ttyAMA0


see if you get output from your Weathershield there

frix

Hi Kilo95,

One of the pics I attached shows the output of minicom, and you can see that the weathershield is being read by the gateway moteino and that the gateway moteino is reporting via serial those readings. So my serial is running OK (just ran it again and it still works)

But then I did:

cd ~/gateway
node gateway.js &

and got the following error:
pi@FrivoPi:~/gateway $ node gateway.js &
[1] 993
pi@FrivoPi:~/gateway $ [10-01-17_20:53:17.064] [INFO]  LOADING USER METRICS...
[10-01-17_20:53:17.210] [INFO]  LOADING USER METRICS MODULE [_example.js]
[10-01-17_20:53:17.615] [ERROR] Cannot open ttyAMA0


... so I guess the serial is not available?

sparky

How is your Moteino connected to your pi? GPIO or USB

frix

I got it wired to the GPIO.

Also, don't know why, but the website is not waiting for sockets anymore, it went past it and now it just shows that there's no nodes (which is expected). Ahh I feel I'm so close! haha

Thanks for helping!

Kilo95

i ran into the same issue. my remote nodes are using an older version of the code set at 115200 bps. The newer PiGateway software is set at 19200 bps. I just set my Pi Gateway to 115200 bps under the settings tab on the Gateway. you might want to check that

frix

So checking... If I run:

Sudo systemctl | grep getty

I see that getty is still running (I thought I had disabled by following THIS post).

How I can set up my system so that getty stops being a greedy douche?


frix

Quote from: Kilo95 on October 01, 2017, 09:14:59 PM
i ran into the same issue. my remote nodes are using an older version of the code set at 115200 bps. The newer PiGateway software is set at 19200 bps. I just set my Pi Gateway to 115200 bps under the settings tab on the Gateway. you might want to check that

Yup, I checked. I've read a bunch of the forums post and that was one of the first things I checked. Everything here is running at 19200 bps.  I can verify that by running minicom. I think the problem is that the serial is being hijacked by getty or other service.

sparky


Felix

@frix - I think you're really close. The serial GPIO console must be enabled and disconnected from the system console.
I posted some instructions in this guide page.

frix

I've done everything in every guide I can find. Including yours. But I just can't figure out how to enable the serial properly. My frustration comes from the fact that I can actually read ttyAMA0 with minicom, but the gateway can't access ttyAMA0 even though I'm using the same settings.

Do you think this has anything to do with me running this on the newest, freshest version of Raspbian (Stretch)? All the guides I see are for older versions.

Otherwise, am I missing something? Felix, have you been able to try the gateway with Raspbian Stretch?

Thanks!

frix

I'll check what they're saying on the raspberry forums and see if they have any solutions for the new distro. I'll keep you guys posted.

I also may just go ahead and get a moteino USB and get over this. haha

Oh, also, is there a reason why I need to manually go an start the app with node? I don't know how to set it so that it starts automatically on boot.

Thanks again!

Kilo95

when I was having issues the other day, I was using a Moteino USB. I have no idea why you have to manually restart the node. I use Felix's Weathershield sketch on one end, a PiGateway sketch on the other. For the RPi, I used PiBakery and went through Felix's steps. It worked fine after I set the transfer rate correctly

Felix

It may have to do with Stretch, i havent tried it yet. In the past, with every new release, there were "breaking" changes to what people were used to. It may be the case here as well.
The setup script installs the gateway to automatically start up when you power the Pi. I will have to look into it when I get a chance. In the meantime if you find a solution please share.

frix

Hi Felix,

Thanks for your replies. Honestly I couldn't find any answers or work-arounds. Maybe if I was more knowledgeable of Linux I could have found something... but what I ended up doing was buying one of your Moteinos USB and that worked like a charm. I now have a working gateway.

I guess I'll keep looking for an answer, both because I believe that the GPIO serial has to be usable, and because of the honor, hahaha.

In the meantime, it would be great if you could check both your install script and gateway with Stretch, and see if you get in any similar issues.

Thanks again!
Oscar