Project

General

Profile

RPi DIJN.10 and ttyAMA0

Added by MobileWill almost 6 years ago

Hi,

I have been playing with Housemon and wanted to run the demo with ttyAMA0 instead of USB. I got it working on USB but when I switch over to AMA0 I get nothing.

I can able to see output from screen without running sudo. I have removed and re added rf12demo with the ttyAMA0 and still nothing. Really odd since it worked with ttyUSB0.

Thanks.

Edit: Now I am trying USB again and its not working lol, but I am using a different fdti cable. Going to try the original one again. If not going to start over.

Edit: So weird it works with the SFE 3.3v Basic but not this other FTDI cable I have.

Does the demo need TX or will RX only work? I ask because the other FTDI cable I have is 5V so I can’t connect the TX part of it.


Replies (11)

RE: RPi DIJN.10 and ttyAMA0 - Added by MobileWill almost 6 years ago

I will have to try when I get another FTDI cable later this week. I rather it work with AMA0, maybe I can try another Pi and see if I can get it to work.

RE: RPi DIJN.10 and ttyAMA0 - Added by galuvian over 5 years ago

I went through DIJN this weekend and got stuck here as well. The ttyAMA0 is not working with Housemon. I tried to look through the src but didn’t see anything obvious. When I attach screen to the serial port everything works as expected. I even discovered that one of my 4 radios wasn’t working (I found a bad solder joint and it is fixed now). But after double checking everything it seems to be an issue with housemon.

RE: RPi DIJN.10 and ttyAMA0 - Added by MobileWill over 5 years ago

Yeah I would have to agree. Maybe a issue can be logged in github.

RE: RPi DIJN.10 and ttyAMA0 - Added by lightbulb over 5 years ago

@MobileWill,

I may be able to help, but will need additional information:
1. I assume you have an RPi (mentioned above). What O/S are you running (debian? which one? - I’d assume wheezy)
2. If debian, then generally its default tty is on AMA0. You have to make sure that its removed. (instructs available all over web) - I can see you used ‘screen’ on /dev/ttyAMA0, so assume you have done this.
3. Which version of HouseMon (there are at least two branches on jcw’s github).
4. Permissions - depending upon account that launches housemon, they may not have access to ‘dialout’ or the relevant group that controls access to your serial devices.

If you have had ttyUSB0 working before, and dont mind loosing some database data (you wont loose config), then try this:
- Remove your serial devices from HouseMon.
- Stop HouseMon
- Use screen to confirm your devices are responding and you are able to send the ? character
#screen /dev/ttyAMA0 57600 (ctrl+a to quit.
same for /dev/ttyAMA0
- Start HouseMon
- Load ‘reset’ briq, click flushDB button (this cleans out your DB as if HouseMon was first started)
- Stop and Start Housemon again.
- System should be back in ‘virgin’ state - nothing in Admin.
- Load your Briq’s one at a time, following DIJN instructs, ‘drivers’ first etc.
- Finally when your ready, load one of your ttyUSB0 or ttyAMA0 via rf12demo briq
- If all well to this point, please report back.
- Finally load the Second serial device and again report back.

—lightbulb

RE: RPi DIJN.10 and ttyAMA0 - Added by andromeda1966 over 5 years ago

Hi,

I have no Jeelink so I have use ttyAMA0 with a Jeenode configured as in this post http://jeelabs.org/2012/09/20/serial-hookup-jeenode-to-raspberry-pi/.
Demo briq as you can see on image Selection_003.png is empty.
I have try your suggestion above but nothing happen on Demo page.
On images attached you can find my Admin page conf, Demo page, test with ‘screen /dev/ttyAMA0 57600’
and last my ttyAMA0 permissions and my id.
Npm is started from pi user ‘npm start’.
I have try to start npm with ‘sudo npm start’ but the same, nothing happen.
Tried also to use /dev/ttyAMA0 but no data received.
So what can I do now ?
Is there a test/log to see if data are coming into HouseMon ?

Thanks in advance
Mauro

Selection_003.png (3.05 KB) Selection_003.png Demo page
Selection_001.png (15.2 KB) Selection_001.png Admin Page
Selection_006.png (5.63 KB) Selection_006.png Screen test for ttyAMA0
Selection_008.png (45.5 KB) Selection_008.png ttyAMA0 permissions and id starting npm start
1321
1322
1323
1325

RE: RPi DIJN.10 and ttyAMA0 - Added by lightbulb over 5 years ago

andromeda1966

good news is you have output from jeenode on ttyAMA0.

Also, it appears you have your serial briq installed ok.

Here is what you must check.
I think from memory (no time to check) that the DIJN series uses 868Mhz Freq and Band=100,
so you must check that your jeenode on ttyAMA0 is set to listen in that frq/band combination.
Also this jeenode I think should be set to master node 31.

The remote jeenode must be ID=1 and same freq/band - I can’t see your band/freq info, but it looks like your nodeid’s are setup ok.

Its then all about your ‘demo’ files - did you create them yourself (following the DIJN series)
or did you download them ready made from somewhere?

When you start Housemon, what output do you see? paste the output here for us to look at.

You can capture the screen data using ‘tee’ like this:
npm start | tee housemon.log

when you stop housemon, a log file will be waiting.

—lightbulb

RE: RPi DIJN.10 and ttyAMA0 - Added by galuvian over 5 years ago

I am in exactly the same situation as MobileWill and Andromeda1966. I ran through all of the steps that you have posted, lightbulb, and my current state is the same as the screenshots andromeda posted.

screen works and I can interact with the jeenode. ? prints the help message and I can see acks of incoming packets.

When I try to set up housemon I don’t see anything in any of the tabs except for Home and Admin.

I totally missed that DIJN.10 assumes group 100 and that the node attached to the rpi is 31 and the Demo screen is filtering for node ID 1 only. I changed the demo.coffee script to use group 212 and set the IDs on my nodes to 31 and 1 respectively. No change. The Status briq just shows a blank page for me too.

Then I added the logger briq and ran tail -f logger\2013\20130708.txt and I can see the output being collected. So that is a good sign.

I wrote a quick sketch to have a remote node send an incrementing integer every second. A simplification of the code from DIJN.11

#include 


void setup () {
  rf12_initialize(1, RF12_433MHZ, 212);
}

byte count = 0;
void loop () {

  byte value = count++;

  // actual packet send: broadcast to all, current counter, 1 byte long
  rf12_sendNow(0, &value, 1);

  // let one second pass before sending out another packet
  delay(1000);
}

I see this output in logger\2013\20130708.txt:

L 03:18:29.773 ttyAMA0 OK 1 0
L 03:18:30.773 ttyAMA0 OK 1 1
L 03:18:31.773 ttyAMA0 OK 1 2
L 03:18:32.773 ttyAMA0 OK 1 3
L 03:18:33.773 ttyAMA0 OK 1 4
L 03:18:34.774 ttyAMA0 OK 1 5
L 03:18:35.774 ttyAMA0 OK 1 6
L 03:18:36.774 ttyAMA0 OK 1 7
L 03:18:37.774 ttyAMA0 OK 1 8
L 03:18:38.774 ttyAMA0 OK 1 9
L 03:18:39.776 ttyAMA0 OK 1 10

But the Status and Demo briqs are completely blank pages for me below the header.

Aha! I found the problem. The code in rf12demo-serial.coffee contains:
if words.shift() is 'OK' and info.recvid

But info.recvid is always blank because I keep restarting npm and the info.x variables are only populated when it sees the help text containing the configuration of the node. In fact, if I’m following along with DIJN it never says to restart the jeenode. So If I unplug the jeenode and put it back in, suddenly the demo page works!

I’m not familiar enough with the event model to suggest a better fix, but I’m going to look into it now.

RE: RPi DIJN.10 and ttyAMA0 - Added by lightbulb over 5 years ago

galuvian,

That will indeed explain things.

I think (but am not sure) that you may have a field called ‘initcmds’ on the rf12demo-serial Briq that will accept data once installed. Because this gets invoked every time a briq is loaded it could be a way the send a ‘?’ - which will in turn solicit the config screen, so try putting a single question mark in this field if present.
Then when npm start’s it should re-issue ? to the jeenode and you’ll get config data supplied to populate the info object.

I have a variant of rf12demo-serial in the latest development branch (called rf12demo-readwrite) that does something similar to this, but is more specific.

—lightbulb

RE: RPi DIJN.10 and ttyAMA0 - Added by galuvian over 5 years ago

Yeah, if I set the default value for initcmds to ‘?’ it will properly initialize everything when the briq is loaded. I’m currently fighting with github to get access to my account to submit a pull request. But you may be able to fix it directly before I can submit it.

RE: RPi DIJN.10 and ttyAMA0 - Added by lightbulb over 5 years ago

galuvian,

I don’t think a fix is relevant except in the sense of perhaps making the documentation clearer.

You see, take the example where you have say a jeenode running collecting data and controlling something, mabe its been collecting sequence information for many hours. Abruptly resetting it every time npm restarts maybe a little harsh, especially as you want it to only supply you a configuration string, specific to rf12demo. This is best handled by the initcmds in that briq, and designing the CLI (rfm12demo) to supply the data in a controlled manner. As rf12demo already supplies this via ‘?’ this seems a perfect solution to me. Of course I am really defending other sketches that maybe doing more than rf12demo is doing, I have a PID controller sketch that would not like to be reset if it did not need to be.

—lightbulb

RE: RPi DIJN.10 and ttyAMA0 - Added by galuvian over 5 years ago

I think we’re on the same page. I just submitted a pull request but I’m completely new to github (from a developer standpoint) and I appear to have created two issue #s.

    (1-11/11)