RAK811 Tracker - HowTo



  • This is the Code I have been trying to get going

    void TestEeprom() {
    
            printf("Eeprom test begin");
            
            char buffer[] = "hello out there";
            char buffer2[64];
            memset(buffer2, 0, sizeof(buffer2));
            memcpy(buffer2, "placeholder", sizeof("placeholder"));
    
            uint8_t result = EepromWriteBuffer(0, (uint8_t*)buffer, sizeof(buffer));
            printf("Write result: %d\n", result);
            printf(result == SUCCESS ? "success\n" : "fail\n");
    
            result = EepromReadBuffer(0, (uint8_t*)buffer2, sizeof(buffer2));
            printf("Read result: %d\n", result);
            printf(result == SUCCESS ? "success\n" : "fail\n");
    
            printf("Read: %s\n", buffer2);
    
    }
    

    This code is resulting in both the read and write code reporting as a fail.



  • @laurent.b

    Hi @laurent.b,
    I was seen your post for programing RAK811 on Ubuntu. There, it says: https://github.com/oguiter/RAK811_BreakBoard/#flash-over-usb

    I wonder if it is possible to program the RAK811 through USB with that, or I must buy some J-Link

    With best regards

    Sebastian



  • @barillaro

    How to Edit and Upload the code without a J-Link on Win10 and Atom
    Download Atom.

    https://atom.io/

    Once Download, install and open Atom up.
    Then go to settings > install, search for platformio

    Install the following.
    platformio-ide-terminal
    platformio-ide
    platformio-ide-debugger

    Once done, download and install the comm drivers for the RAK811
    http://docs.rakwireless.com/en/RAK811 TrackerBoard/Tool/CP210x_Windows_Drivers.zip

    Then download the git from OlofAst

    https://github.com/Ebiroll/RAK811_BreakBoard

    open Atom, on the PlatformIO Home Tab, go to Platform

    Search ST STM32, Install

    Then click Reveal

    It will open up a Explorer window, then open folder ststm32/boards

    copy the file from OlofAst’s git, rak811.json to the ststm32/boards folder.

    Then in Atom, click open folder.

    Open the folder RAK811_BreakBoard from OlofAst’s git.

    Then open the Terminal in Atom

    To edit the DevEUI and etc… open the file src\Commissioning.h
    Save, and close the tab.

    Now to Compile.

    In the Terminal window in Atom type: pio run
    if you see SUCCESS, compiling went ok

    Calculating size .pioenvs\rak811\firmware.elf
    text data bss dec hex filename
    53236 1628 5244 60108 eacc .pioenvs\rak811\firmware.elf
    ===[SUCCESS] Took 12.25 seconds

    Now to Upload .bin file to the board
    Change the jumper on the board.

    Connect the usb, go to Device manager and check what is you comm port number for the board.

    Then in the terminal window In Atom, run the following
    stm32flash_src/stm32flash.exe -w .pioenvs/rak811/firmware.bin COM5

    This will upload the .bin file, the result should be

    stm32flash 0.5

    http://stm32flash.sourceforge.net/

    Using Parser : Raw BINARY
    Interface serial_w32: 115200 8E1
    Version : 0x31
    Option 1 : 0x00
    Option 2 : 0x00
    Device ID : 0x0429 (STM32L1xxx6(8/B)A)

    • RAM : 32KiB (4096b reserved by bootloader)
    • Flash : 128KiB (size first sector: 16x256)
    • Option RAM : 32b
    • System RAM : 4KiB
      Write to memory
      Data size: 54868 bytes
      Erasing memory
      Wrote address 0x0800d654 (100.00%) Done.

    You should all be done. Unplug, change the jumper back to original position.
    Power up the board and it should connect to the AP.
    To monitor the board, download Uart Terminal, Connect to the Comm port of the board, at baud rate 115200

    https://sourceforge.net/projects/uartterminal/

    RAK811 BreakBoard soft version: 1.0.2
    Selected LoraWAN 1.0.2 Region: EU868
    OTAA:
    Dev_EUI: XX XX XX XX XX XX XX XX
    AppEui: XX XX XX XX XX XX XX XX
    AppKey: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
    OTAA Join Start…
    OTAA Join Success

    https://www.thethingsnetwork.org/forum/t/rak811-tracker-board/11006/182



  • @qlion
    AMAZING explanation!!!

    I will try this today. Also, I will try on MacOS. (I don't have a windows10 now). I will let you know.

    Thank you very much for all your help.

    With best regards

    Sebastian Barillaro



  • @qlion Your instructions are awesome. Thank you!!!

    I am having a problem uploading the .bin file.

    You stated to "Change the jumper on the board." Change it to what? I originally had the jumpers on SWD_CLK and SWD_TMS. I tried running the code with the jumper in place and after removing it.

    This is what I see everytime:
    0_1523828088934_upload-c2007c4e-f934-4ca2-a21f-c16439665d43 It seems like it is not recognizing serial_32.

    How can I fix this issue. I believe I followed all of your instructions. Thanks



  • Hi,
    In rak 811 sensor node I want to measure LDR(light dependent resistor) value an analog one.With which pin can I measure , i mean pin definition and pin name!
    In arduino i used to write
    int sensorValue = analogRead(A0);
    How can i write that in RAK811 sensor node?



  • @barillaro

    1. If you need to flash your .bin file then the jumper should be in this mode0_1524140655430_photo_2018-04-19_17-53-58.jpg

    2. If you need to communicate/at commands with the device you should change the jumper to this position0_1524140706814_photo_2018-04-19_17-53-52.jpg

    Correct me if I'm wrong



  • @maheshblazer1
    You need to modify it in open source projects.
    First find an unused ADC pin, then initialize it to ADC, then read the voltage value of this pin.



  • @xc.c
    how many ADC pins are there in RAK811 sensor node!(i haven't used any pins)
    (As I read from schema PB12, PB14, PB15, PA1 are ADC pins right, correct me if I'm wrong)
    How to initialize them?
    What is the syntax for analog read?

    int sensorValue = analogRead(A0);

    could you write an example code for above line?



  • @maheshblazer1

    Thank you for yours picture! I will try soon and let you know!



  • @maheshblazer1 The pictures helped, thank you. I was able to upload the .bin file and get the proper output on the terminal.

    Another question:
    I did this -->"You should all be done. Unplug, change the jumper back to original position. Power up the board and it should connect to the AP."
    I unplugged, changed the jumper to your picture 2, and plugged it back in.

    I tried this several times. I even took it outside for 5 min. The rak811 never connects to ttn. I have a gateway setup and connected.
    The device and application EUIs and app key have all been changed.

    I am also monitoring using Uart Terminal. The following is what I get:
    Dev_EUI: XXXX...
    AppEui: XXXX...
    AppKey: XXXX....
    OTAA Join Start...

    This is what I see on the ttn:
    0_1524538040708_ttn.PNG

    0_1524543135894_ttn2.PNG

    What am I missing? How do I get my device to connect and map?



  • @Blue_Spring we frequency are you using for your gateway and RAK811?



  • @coeus I am using 915MHz for the gateway.
    For the device, the ttn network shows it connected to "ttn-handler-us-west (current handler)". But the UART terminal states:
    RAK811 BreakBoard soft version: 1.0.2
    Selected LoraWAN 1.0.2 Region: EU868
    OTAA:
    Dev_EUI: XXX..
    AppEui: XXX..
    AppKey: XXX..
    OTAA Join Start...

    I am guessing this is where the problem is. It should be US915 for both instead of EU868 for the device.
    How can I change it? - Thank you

    Edit:
    I changed the frequency of RAK811 to US915 by going to platformio.ini in atom but the problem still persists. I still get:
    OTAA:
    Dev_EUI: xxx...
    AppEui: xxx..
    AppKey: xxx...
    OTAA Join Start...

    What am I missing? - Thanks



  • IM having the same problem, stuck on "OTAA Join Start...."

    Gateway and node had the same region, i checked on the gateway and see a rx and then a tx in the same channel (the specs says tx ch = rx ch modulo 8) so it has sense that almost always the gateway respond to the same channel, but the node can catch the response....

    anybody had this working? can you share node code AND global_conf.json from the gateway please? for US915 or AU915



  • @Blue_Spring

    Hi

    in main.c change the following.

    #if defined( REGION_EU868 )
    to
    #if defined( REGION_US915)

    Should be line 54..



  • @Kevlar042 Do you still have trouble with the EEPROM?


Log in to reply
 

Looks like your connection to RAK Support Center was lost, please wait while we try to reconnect.