Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Output dmesg over radio #94

Open
ea opened this issue Jun 24, 2018 · 8 comments
Open

Output dmesg over radio #94

ea opened this issue Jun 24, 2018 · 8 comments
Assignees

Comments

@ea
Copy link
Contributor

ea commented Jun 24, 2018

It would be nice to be able to dump the debug messages over radio, in case something weird happens.

I've started work on this and have an app that does TX-ing. It will likely need more testing and tweaking of packet sizes , and a proper RX side (rtlsdr script even?). Will be on my branch until ready.

Comments?

ea added a commit to ea/goodwatch that referenced this issue Jun 24, 2018
Uses the exact same settings as beacon app, so on recieving side a
beacon sniff can be used (imprecisse though).

It sends the dmesg log in 32 byte chunks, but does a small optimization
by skipping all-null chunks.

Would probably need to send bigger chunks, and write a proper reciever.
@travisgoodspeed
Copy link
Owner

This would be handy!

Best bet is probably to have the host computer listening at all times, with the device radio dumping dmesg every hour when configured to do so, and also once at startup of the prior boot's dmesg.

ea added a commit to ea/goodwatch that referenced this issue Jul 2, 2018
Made a gnu-radio workflow that uses rtlsdr to sniff for and demodulate
beacon and dmesg packets. Currently bits are spewed into a file and
decoded with a separate python script.

Need to figure out how to properly do packets in gnuradio.
ea added a commit to ea/goodwatch that referenced this issue Jul 16, 2018
After testing some other packet modem configurations, I don't see too many benefits
to require changing the defaults (both in packet.c and beacon app config).

After debugging with sdr scripts, cleaned up the code a bit and it works.

Beacon sniffing option in the console app can also be used to receive the dmesg log.
@ea
Copy link
Contributor Author

ea commented Jul 16, 2018

I've been playing around with this and it appears that if the battery is anything less than completely new , and dmesg buffer is a bit long, sending packets very quickly one after another causes a reboot itself. The artificial delay in the transmit loop seems to alleviate this a bit and also helps the receiver keep up.

Currently there are two ways to receive the dmesg log. One, through goodwatch.py and option -B , which might require a bit of timing, but seems to work fairly well for me (it also requires two watches). And two, through supplied rtlsdr GnuRadio script, which is seems much cleaner, if one has an rtlsdr lying around.

To go with gnuradio route, one first runs goodwatch_sniff.py script which will dump bits into test.bin. One might need to fiddle with PPM correction and frequency settings in the goodwatch_sniff.grc if it doesn't work out of the box (my rtlsdr has a particularly high PPM correction requirement). Then, after the packets are transmitted, running decode_goodwatch.py should spit out the dmesg log.

Anybody willing to test this? To make sure it doesn't suffer from the old "works on my machine only" illness...

It would indeed be cool to have it chirp out only new messages every hour, if in "debug" mode of some sort, but I need to figure out how to schedule it first and how to do a tx callback from outside an app :).

@travisgoodspeed
Copy link
Owner

I should have time to try it out this week.

@travisgoodspeed
Copy link
Owner

@ea You might try updating your fork to master, then transmitting packets of just the battery voltage, to see where it fails.

@travisgoodspeed
Copy link
Owner

@ea I merged the beginnings of a dmesg application. For now, it just scrolls the buffer on the screen, but we can merge radio code into it soon.

@ea
Copy link
Contributor Author

ea commented Nov 11, 2018

Ah, i see where you are going with this. Neat. I was just playing with the gnuradio receiver the other day and made it easier to use. The trouble was in figuring out the exact frequency due to drift in different SDRs. I'll update my fork and add some code that might be useful.

@travisgoodspeed
Copy link
Owner

We also have a bit of our own drift. Perhaps we can calibrate for it, the same way we do the RTC correction?

@ea
Copy link
Contributor Author

ea commented Nov 19, 2018

I have seen pretty large drifts between 3-4 devices i have, but i suspect one to be an outlier due to poor soldering on my side. I don't have a gw30 built yet so i'd stay out of that.

I added a simple gnuradio rtlsdr script that can receive messages as sent by beacon app (and my prototype dmesg sending app) here https://github.com/ea/goodwatch/tree/sdr_testing/bin/sdr

I didn't make a pull request as i'm unsure if you want to taint your repo with sdr stuff, but thought i'd point it out in case somebody ends up needing it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants