[SOLVED] Flashing ATSAMD21G18 to Internal Flash

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Flashing ATSAMD21G18 to Internal Flash

    Hi Everyone,

    So I'm relatively new to ARM uCs. I've played with lots of mbed boards, AVRs and PICs. Although now I'm trying to get more professional in my hobbyist life haha.

    So I'm trying to flash a bootloader to a ATSAMD21G18 through my Segger J-Link EDU. I'm using Atmel Studio (also tried J-Flash Lite) and everything works perfectly... Until i un-plug the j-link. This also happened on a development I was playing with (4357-evb), but at the time I did not care, as I was just playing around.


    While the J-Link is still plugged in my bootloader works fine. A have my LED flashing, telling me that the program is working fine. But when I un-plug the j-link everything stops works (as if the flash was empty).


    I'm sure I'm doing something wrong. Is there something extra I have to buy, to be able to physically write to the uC internal flash?


    Thanks Everyone,

    Sam
    Images
    • J-Link.png

      38.64 kB, 762×603, viewed 709 times
  • Hi Sam,


    sounds strange to me....
    You are sure that your target board is not powered by the J-Link and that are writing to Flash, not RAM?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    I'm powering the board by an external power supply (commoned to the J-Link common).

    From the screen shot attached and as far as I can see I'm programming to flash not ram (how can i double check?). I've tried your J-Flash lite program and same results.

    Any idea where to go next?

    I basically want the program / bootload to remain on the uC after the jtag is disconnected.



    Sam
    Images
    • Screenshot_1.png

      30.52 kB, 795×622, viewed 448 times
  • So further to the above.

    I have removed the reset pin from the J-Link connector and now when I unplug the J-Link the board continues to work.

    But when I turn the power to the board off and then on again the board stops working again (like the flash is empty).

    This says to me that its as if the J-Link is programming the RAM and not the Flash.

    Any suggestions on how I can test/fix this?

    Sam
  • Hi Sam,


    Question 1: You can consult the manual of the device for the devices memory map - this will show at which address the RAM (e.g. 0x20000000) and the Flash (e.g. 0x8000000) of the target device is.
    Question 2: You need to find out where your IDE puts your application. You can either check the projects settings, maybe a map file or, alternatively, check the .bin/.hex/.elf file the IDE build with a tool of your choice.

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.