Open terrillmoore opened 7 years ago
@terrillmoore some dissonence between the updated readme and information provided here. For example, I was unable to complete the LoRaWAN provisioning section successfully--couldn't get my device registered to my application. However, once I found this issue, specifically the "Reprovisioning" section at the end of this issue, I entered in
lorawan configure nwkskey 0
lorawan configure appskey 0
lorawan configure devaddr 0
lorawan configure netid 0
And then the serial monitor went into a loop of EV_TXSTART, EV_TXSTART, etc.
Then I git cloned your random sysEUI generator here into my project dir, ran:
cc random-eui.c
./a.out
and grabbed the generated sysEUI printed in my terminal window. You reference it as a potential devEUI above, so on the TTN console I was able to change the devEUI there, and use the command from the above:
system configure syseui yoursyseui
in my serial monitor in atom via platformIO (which could be done in any terminal with cli installed):
pio device monitor --port /dev/cu.usbmodem1421 --baud 115200
then I ran through the LoRaWAN Provisioning commands from the README.md using the generated sysEUI as my devEUI, and now I'm finally seeing packets hitting my backend on TTN console.
This is a bit of a debug dump (sorry). I'm make a pull on your README, and hopefully you can cherry pick somethings that are useful to help people out.
Thanks for your support, excited to have the Catena4450 up and running via TTN.
Another quick thing to consider adding into the README.md is the payload decoder option in the TTN console.
I dropped your code from your Catena message decoder for TTN into my decoder function on the TTN console and now I have lovely human readable data to view without converting hex in my brain - which I can't do thaaaaat well at this point anyway.
Hm, the info here is better than some of the info in the README.md. Leaving this open in hopes that I'll remember to update the README. But we need to split up this repo (keep 4410 separate from 4450, etc.)
Provisioning is done in one of two ways:
Static (hard-wired in code) Provisioning
In this case, the programmer decides once and for all how a given CPU is going to be used. This is efficient but inflexible, and doesn't scale well, because all CPUs must be mentioned in a table. Still, for small projects this may be appropriate.
MCCI-Catena4410-Arduino-Library/src/lib/gk_WellKnownCpuBindings.cpp
. This also defines the base platform to be used for this CPU.catena-lorawan-provisioning/extra/gk_lorawan_keys.project.cpp
.Dynamic (FRAM-based) Provisioining
If your platform contains a compatible FRAM chip (see, for example, the MCCI Catena 4450), you can dynamically provision your device using USB commands. There are two parts: setting up the FRAM so that the platform is correct, and setting up LoRaWAN.
Entering USB commands
USB provisioning commands are entered in the box at the top of the Arduino terminal. They can also be entered using any standard terminal program (e.g., TeraTerm). Commands are not echoed. Command lines may be terminated with carriage return or line feed.
The command parser will reply with one or more lines of text, separated by newline (line-feed) characters. The last line will either be "OK" (indicating success) or
?
followed by an error code (for failure). If you get no response, you should assume that the command has not been executed.The
echo
command can be used to check that the command parser is functioning. If you enter the commandecho hello world
, the program should display:Note: your terminal program might display something like:
In this case, you should adjust the terminal program settings so that it displays "linefeed" as "cr-lf" or "newline".
Setting up the platform
If you're using a Feather M0 LoRa with added FRAM, use the sketch Catena4450m101_sensor1 to get started. Download it, and boot. The debug print will complain about not being configured. Don't worry yet.
system configure syseui
yoursyseui
(Change yoursyseui to the SysEUI you selected in step 1.)system configure operatingflags 0
Otherwise, if you want your program to boot up without waiting for USB, saysystem configure operatingflags 1
system configure platformguid 82BF2661-70CB-45AE-B620-CAF695478BC1
For the Catena 4450 M102, usesystem configure platformguid 2281255E-AC5C-48CB-A263-9DC890D16638
Once the platform is set up, you don't have to change it unless you complete reset the FRAM contents.
Provisioning for LoRaWAN and The Things Network
This provisioning should be repeated whenever the network keys change. Both OTAA and ABP configuration are possible, however, we strongly recommend OTAA, and we leave application of ABP to the interested user.
lorawan configure deveui
thisDevEUI
(ChangethisDevEUI
to the value determined in step 1.)lorawan configure appeui
myAppEUI
(ChangemyAppEUI
to the value determined in step 1.)lorawan configure appkey
thisAppKey
(ChangethisAppKey
to the value determined in step 1.) Very important: don't use the same AppKey value for multiple devices, or you'll compromise the security of your device!lorawan configure join 1
Reprovisioning
Reprovisioning is the same as provisioning, but you should add teh following commands to make sure all prior state is reset:
Then continue with provisioning as given above.