Sensebender Gateway (SAMD21)



  • Re: đź’¬ Sensebender Gateway

    I like the Sensebender Gateway approach, based on the SAMD21. Although I plan to build a micro gateway in a first step, I'd like to try to build the software for the SAMD21 version to gain some experience with it. But I'm using PlatformIO right now and I'm not sure how to integrate the board information there. I was now able to find it using the built-in search functionality. Does someone know I can make the board available in PlatformIO and can write some lines about the necessary steps, please?


  • Hero Member

    @pikim I found no (quick) solution yet and I'm interested in that as well. 🙂



  • @TimO
    Do you have hardware available? In the meantime I found out which files have to be copied where. Now I can select the board and the build succeeds. But as I have no hardware yet, I can't try the result.


  • Hero Member

    @pikim Yes, I do have a sensebender gateway that i am planning to use for an energy Meter. I am currently struggling with the circuit but the sensebender is running fine (with the arduino IDE though).

    What did you copied where?



  • @TimO said in Sensebender Gateway (SAMD21):

    Yes, I do have a sensebender gateway

    It's great to hear that. Given that VS Code with PlatformIO is already running:

    • install "Atmel SAM" from PlatformIO -> Home -> Platforms. Then you should have .platformio/packages/framework-arduino-samd/ in your users directory.
    • download https://github.com/mysensors/ArduinoBoards/blob/master/boards/mysensors-samd-1.0.6.tar.bz2 and unzip it
    • integrate the unzipped data from inside mysensors-samd-1.0.6 into the according folders in .platformio/packages/framework-arduino-samd/, that means
      • the content from mysensors-samd-1.0.6/bootloaders into .platformio/packages/framework-arduino-samd/bootloaders/
      • the content from mysensors-samd-1.0.6/driver into .platformio/packages/framework-arduino-samd/driver/
      • the content from mysensors-samd-1.0.6/variants into .platformio/packages/framework-arduino-samd/variants/
    • append the active part from mysensors-samd-1.0.6/boards.txt to .platformio/packages/framework-arduino-samd/boards.txt
    • create .platformio/platforms/atmelsam/boards/sensebender_gw.json. I took the mkrzero.json from that folder and adjusted it to the Sensebender. So the content of .platformio/platforms/atmelsam/boards/sensebender_gw.json is:
    {
      "build": {
        "arduino": {
            "ldscript": "flash_with_bootloader.ld"
        },
        "core": "arduino",
        "cpu": "cortex-m0plus",
        "extra_flags": "-D__SAMD21G18A__",
        "f_cpu": "48000000L",
        "hwids": [
          [
            "0x1209",
            "0x6949"
          ],
          [
            "0x1209",
            "0x6948"
          ]
        ],
        "mcu": "samd21g18a",
        "usb_product": "Sensebender Gateway",
        "variant": "mysensors_gw"
      },
      "debug": {
        "jlink_device": "ATSAMD21G18",
        "openocd_chipname": "at91samd21g18",
        "openocd_target": "at91samdXX",
        "svd_path": "ATSAMD21G18A.svd"
      },
      "frameworks": [
        "arduino"
      ],
      "name": "Sensebender Gateway",
      "upload": {
        "disable_flushing": true,
        "maximum_ram_size": 32768,
        "maximum_size": 262144,
        "native_usb": true,
        "offset_address": "0x2000",
        "protocol": "sam-ba",
        "protocols": [
          "sam-ba",
          "blackmagic",
          "jlink",
          "atmel-ice"
        ],
        "require_upload_port": true,
        "use_1200bps_touch": true,
        "wait_for_upload_port": true
      },
      "url": "https://www.arduino.cc/en/Main/ArduinoBoardMKRZero",
      "vendor": "Arduino"
    }
    

    It's not a perfect solution as it's integrated into the already existing Atmel SAM package, but it's enough for testing imo. I'l keep trying to figure out how to make a dedicated package for the Sensebender.

    It would be great if you could follow these steps and create a new project and select the sensebender as board. Please tell me whether it worked or not.


  • Hero Member

    @pikim Wow, nice! Yes it is working just fine! Good work, thank you!



  • @TimO
    Just for clarification: you can build an application and it works as desired?


  • Hero Member

    @pikim Yes, I have tested with a blink example to light up an build in LED and that just worked as expected.



  • @TimO
    Cool! Could you keep me informed if you tried a more sophisticated application, maybe with some NRF24, RFM69 or Ethernet communication, please?



  • Just for completeness: the right way to do this is to add the json under ~/.platformio/boards and the other files as described in https://community.platformio.org/t/how-use-a-same-chip-but-with-different-environment/18082/4


Log in to reply
 

Suggested Topics

62
Online

11.4k
Users

11.1k
Topics

112.6k
Posts