Arduino MKR WAN 1300

I think I see the source of the problem. The murata module firmware calls at_Receive asynchronously when it receives a LoRa downlink:

static void LoraRxData(lora_AppData_t *AppData)
{
set_at_receive(AppData->Port, AppData->Buff, AppData->BuffSize);
at_Receive(NULL);
}

To fix this, we need an option that allows us to turn off the call to at_Receive() in the murata module and add a function to the MKRWAN API that allow us to call this function from our application. That way, when we sleep, we will not miss the asynchronous transmission of data from the module.

I opened an issue on Github.

1 Like

Hi @Amedee I was going to try and compile the module firmware to address this issue. Do you have any pointers on how to do that? I have Eclipse installed (note, I am not familiar with Eclipse). I built the package but do not know how to create the fw.h to program the module.

Yes, I was suspecting something like that, just had no time to look at the code…

I really like this board, but the more I use it, the more I find the API and implementation a limiting factor for somewhat advanced usage…

I haven’t use Eclipse before either :wink:
Nice editor, but quite complex at start.

I have a little script to generate the firmware file:

#!/bin/bash

FwBaseDir=~/Development/TTN/mkrwan1300-fw
FwVersion=Projects/Multi/Applications/LoRa/AT_Slave/inc/version.h
FwDir=Projects/Multi/Applications/LoRa/AT_Slave/SW4STM32/B-L072Z-LRWAN1/mlm32l07x01/Debug
Fw=mlm32l07x01.bin
MkrWanDir=~/Documents/Arduino/libraries/MKRWAN/examples/MKRWANFWUpdate_standalone
FwInclude=fw.h

cd "${FwBaseDir}/${FwDir}"
(
  awk '/AT_VERSION_STRING/ { print "// Firmware version: ", $3 }' "${FwBaseDir}/${FwVersion}"
  echo -n "const "
  xxd -i "${Fw}"
) > "${MkrWanDir}/${FwInclude}"

(It is just a one liner – xxd – but as I forget easily I prefer to wrap in a script :wink: )

Yes, I agree. Seems to me like the developers do not yet grasp the importance of low power. I think this is a good product but still quite green. Would be cool if they would integrate a WiFi module with the LoRa module like the LoPy. I do not prefer the LoPy because you reboot the device every time you sleep so there is quite a bit of latency and power wasted doing that.

Thank you for the script! This answers a lot of questions … like where to look for the correct bin file! :wink:

What do you use to compile the source?

The recommended stuff: Eclipse with the STM32 System Workbench.
(I have no experience with that other than tinkering with the firmware to submit my patches…).

Also be careful, your file system must be case sensitive as there are a couple of files named identically except for the case (it took me some time to realize that, git was showing the directory tree dirty just after a checkout). So Linux is not a problem, OSX needs a case sensitive parition, Windows I have no clue.

Ok, so you are using Eclipse. Good to know. I can compile the source using Eclipse. I was able to download the firmware and run it using your script. Thank you.

I also tried to build using the arm tools with Visual Studio Code. I can’t figure out though where the makefile for the AT_Slave project is. There is a makefile at the root of the mkrwan1300-fw directory and if I build that, it flashes but doesn’t run. If I descend into the AT_Slave directory, there is no makefile. There is an eclipse project file and an auto generated makefile in the Debug directory, but I think that makefile is generated by Eclipse.

Yeah…
If my memory serves well, I first tried from the command line with the Makefile, but I had no success with that, then I followed the Eclipse route and that worked well.

I made the change and it fixed the issue.

Thank you for your help on this matter. :slight_smile:

1 Like

FYI: I noticed the MKR WAN library and the firmware were recently updated. I did not yet install them.

If you are referring to a LiPo battery, the answer is no.
While the nominal voltage is 3.7v, a fully charged LiPo delivers 4,2v which is too high.

LiFe battery is ok (3.2v nominal, 3.6v fully charged)

1 Like

Thank you very much.

Also another question if for example I used a Power Bank like https://www.tp-link.com/us/products/details/cat-5524_TL-PB2600.html would it work (powering it through the micro-usb port)? I’ve seen some people complain that Power Banks tend to turn become empty after a while but has larger battery capacity so what would be the issue?

That works perfectly via USB port.

Except that some of them cut off automatically if you don’t draw enough power (I have one of those :smile:)

1 Like

I normally play with power banks, maybe it’s a waste of power and space in real world applications, but for experimenting is ok. By the way, my best one is a credit-card sized one, that stays below a breadboard. However, specifically with the MKR WAN I am also using two AA batteries with a battery holder; not bad even with the high consumption bug.

1 Like

@UdLoRa Well for now I just need it to hold it in a second to second readings and sums (with LoRa messages every 30 minutes) for 4 months.

Except that some of them cut off automatically if you don’t draw enough power

Well will have to be careful with that lol.

Is it possible to send a port number in modem.write() when transmitting the data?
According to documentation it is not possible.

You can use setPort to specify the port used by write.

I am using a 2xAA battery supply for the arduino MKR WAN. Is it possible to read the battery level? If yes, are there any tutorials or code examples?