Closed michael-bartmann closed 4 years ago
I do not really understand the buffer offsets. I am more a Java developer. But it I change line #1002 of TTN_esp32.cpp to: std::copy(LMIC.frame + 9, LMIC.frame + 9 + LMIC.dataLen, downlink); the receiving of Downlink messages works just fine. So maybe LMIC.frame isn't the right field offset? Works for me...
you're right LMIC.message contains the information of the MAC frame the first byte corresponds to the operation code, the next 4 correspond to the address the next 2 to the frame counter finally the last to the port number. Then the data arrives. see Lorawan doc page 15 and next. corected
add 9 bytes offset in mac frame to get payload.
The code worked almost immediately with my Heltec V2 board without having to adjust pin mapping. Both OTA and ABP work. Uplink payloads are delivered to the TTN console just fine. But downlink messages are not. The registered onMessage function is called, but it points to some other stuff. When I receive large messages, the real start is sometimes 9 bytes further in the buffer, seemingly hidden after other (header?) fields.