Hello there!

I recently bought this SAM R34 evaluation board from Tindie with hopes to get to know the processor before doing a custom HW implementation.

I ran into many shortcomings though. With the previous processors I was using Platformio and the Arduino framework.

I found that there are basically four options for programming this chip.

  1. Microchip Studio with the AFS framework. This is the native for the chip. It works, but lacks documentation and has a steep learning curve. It would also cause problems for the software development if I decided to use STM or other platform in the future. As far as I can tell this is the only way (correct me if I’m wrong) to do advanced HW debugging with this chip.

  2. Mbed OS. It works with the Mbed OS, but not with the official build, just this modified one. I could get the software to compile but it wasn’t possible for me to upload it with the Mbed Studio and when I uploaded the binary I didn’t get any results either. Even if the binary upload would work, there is no option for debugging.

  3. The Arduino core for SAM R34 by Wiz-IO. This seems very nice but apparently is only able to upload programs using the EDBG chip found only on the SAM R34 Xplained Pro Evaluation Kit. There are some people that are saying this works with the RAK4260 (which is much closer to the board I have), but I couldn’t setup this.

  4. The BastWAN Arduino core with this UF2 bootloader. I had the most success with this method. It was the only method using which I could compile, flash and debug (though only trough console printouts) my code. I quickly could get a direct LoRa link to work using the example Arduino code found here.The problem came when I tried to use LoRaWAN. I tried using 3 different libraries: TinyLoRa (which I used with the previous HW), Beelan-LoRaWAN and Arduino LMIC. With TinyLoRa, the code acted as if everything was working alright. I even got the very same debug messages (register writes and reads) as with a healthy SX1276 circuit. I received nothing on the TTN console though. I tried both OTAA and ABP and checked all adresses about 10 times. Beelan-LoRaWAN also acts as is if it were transmitting, but there are not register writes and reads happening. Arduino LMIC just bricks the processor and I have to reflash the bootloader using SWD.

Does anyone use any of these frameworks successfully and can give me a hint about what I’m doing wrong? Thanks.

First thing to do is get an SWD adapter (eg what the EDBG is an example of, though it is far from the only choice) and learn to use it with something like openocd or pyocd independent of the build flow.

In theory that would let you debug Arduino code, too, but you may(?) need to modify the build process to retain symbols, and you may end up having to debug against the concatenated together sources in the tmp folder rather than the originals.

1 Like

Yes, that’s what I used for flashing with the first 3 options and for flashing the bootloader in the fourth option.

I have it installed now, I can run it and establish a SWD connection with the target. I don’t know all the important commands yet.

I see, I can try that too later.

But I still have problems with LoRaWAN. As far as I know, the RF switch (I think that’s where the problems come from) on the board should have 3 important inputs (RX/TX, RFSW_ON and BAND_SEL). The problem is that the BastWAN pinout in no way resembles neither the RAK4260 pinout or the SAM R34 pinout.


At this time the ICE-Programmer is 15% cheaper.
End @ 31.12.


Thanks for the notice. Is there any advantage when simply programming this processor against when using a Jlink EDU? I mean surely there are advantages but it probably won’t resolve these issues straight away.

Some programmers are a bit faster than others, some may be supported in more PC-side software packages but generally if you have something that works for your targets of interest there’s little reason to change unless there’s are particular problem you think a different one would fix.

Hello, I was exactly in the same situation.
What I have done so far for being able to use platformio with RAK4260/SAMR34 with Arduino:

  • Provide a custom atmel-sam platformio platform including the BastWAN Board
    /h-filzer/platform-atmelsam based on platformio’s platform (just adding the boarddefinition)
  • Incorporated the Arduino port of Electroniccats into a modified framework-arduino-samd platformio framework h-filzer/ArduinoCore-samd
  • Incorporated the Electroniccats cmsis-atmel into a new framework-cmsis-atmel h-filzer/CMSIS-Atmel (basically clone repo and adopt paths and add descriptors)

I use BMP for upload and debugging and without any bootloader.
Got OTAA working joining to a Chirpstack on EU868.

See the bootstrap example:

Maybe u have to adopt the pin mappings in the arduino core to match your board…

Next steps are to check low power and using ATTEC608A security chip.

This is very cool. We were trying to do this, but couldn’t figure out the exact way for it.

We tried this with the Segger Jlink and both upload and debugging works, which is awesome!

Sad thing is that we din’t manage to get LoRaWAN work for us, even though it did work with the BastWAN core. It might just take a bit more trial though.

The security chip is not very important to us, but the low power is very important. From what I understand, currently you can use the full low power potential only with ASF, and the Arduino cores take around a 1000x times more current, and with the BastWAN libraries, the core can’t wake up from the sleep, so it’s not much of a sleep. With the RIOT core, it can wake up, but it still isn’t very low power. How confident are you in implementing the full low power? Is it relevant for your use? Thanks.

Yes, low power is mandatory as the nodes will be battery powered. A quick measurement is about 4mA which is way too much drain. Quite high for a low power chip, despite the fact that it will not wake up (2uA might be okisch with all the peripherals on the board). I am not used to the power domains of the samr/saml and a quick look at the datasheet was disappointing as i realized: this is too complicated for my head. The ASF examples are no use to me cause i dont have understanding of ASF. So the route to go is to understand and analyse the ASF code and try finding the differences in the Bastwan/Arduino source…

We were looking into that too, but it’s very time expensive at the moment, Wish you the best of luck then, I believe that you can make it work!

Same issue here, best of luck.