Giter VIP home page Giter VIP logo

Comments (7)

samyk avatar samyk commented on May 11, 2024 1

Okay, I've resolved the issue regarding flashing via USB on the Pi and have that working now, however I am still not able to flash via UART (I was using the Pi's version of bossac which is outdated [1.3a], now upgraded to 1.7.0)

Any suggestions? Thanks!

pi@rpidev:~/bootloader $ sudo stty -F /dev/ttyS0 1200
pi@rpidev:~/bootloader $ sudo ~/bossac --info --debug --port ttyS0 --erase --write --verify --reset -U false blinkfirmware.bin
Send auto-baud
Set binary mode
No device found on ttyS0
pi@rpidev:~/bootloader $ sudo stty -F /dev/ttyS0 115200
pi@rpidev:~/bootloader $ sudo ~/bossac --info --debug --port ttyS0 --erase --write --verify --reset -U false blinkfirmware.bin
Send auto-baud
Set binary mode
No device found on ttyS0
pi@rpidev:~/bootloader $ atreset
pi@rpidev:~/bootloader $ sudo ~/bossac --info --debug --port ttyS0 --erase --write --verify --reset -U false blinkfirmware.bin
Send auto-baud
Set binary mode
No device found on ttyS0

I can get into SAM-BA monitor mode

from bossa.

samyk avatar samyk commented on May 11, 2024 1

Some notes I left myself in case it helps others (doing this from a Raspberry Pi):

  • You must first disable BLE on Pi (dtoverlay=pi3-disable-bt enable_uart=1).
  • I've also had to run this twice in some cases.
  • You may need to adjust serial0 to serial1 or greater if there are multiple serial devices
  • You may need to adjust the serial in serial0 to ttyAMA
  • You may need to remove console= section and set core_freq=250 in /boot/config.txt, then run

First you must get the chip in bootloader mode by holding PA15 low and pulling the reset low.
"The bootloader will check PA15 on reset to determine if the bootloader monitor shall start. This feature allows the end user to reprogram the device even if the application is corrupted or una- ble to start the SAM-BA monitor"

alias gp='gpio write'
gpio mode 1 out
gpio mode 7 out
gp 1 1
gp 7 1
alias slp='sleep 0.3'

# on pi, reset atsam (pull RESET pin low)
alias atreset='gp 1 0 ; slp ; gp 1 1'

# on pi, go into atsam bootloader (pull PA15 low during reset)
alias atbootloader='gp 7 0 ; slp ; atreset ; slp ; gp 7 1'

# go into sam-ba monitor mode when using arduino sam-ba bootloader
atreset ; atreset

# go into bootloader mode when using femto (real) sam-ba bootloader
atbootloader # doesn't always work?

sleep 1

sudo bossac --info --debug --port serial0 --erase --write --verify --reset -U false blinkfirmware.bin

from bossa.

samyk avatar samyk commented on May 11, 2024

This is interesting. I mentioned I was able to use bossac over USB -- that was from another machine (macOS) but onto the same board (ATSAM). When I attempt to use bossac on the Pi, I get the following:

pi@rpidev:~/bootloader $ ls /dev/ttyA*
/dev/ttyAMA0
pi@rpidev:~/bootloader $ atreset
pi@rpidev:~/bootloader $ ls /dev/ttyA*
/dev/ttyACM0  /dev/ttyAMA0
pi@rpidev:~/bootloader $ sudo stty -F /dev/ttyACM0 1200
pi@rpidev:~/bootloader $ sudo bossac --info --debug --port ttyACM0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0x400e0740)=0x60000
chipId=0x060000
Unsupported processor
Send auto-baud
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0x400e0740)=0
readWord(addr=0x400e0940)=0
chipId=00000000
Unsupported processor
No device found on ttyACM0

from bossa.

samyk avatar samyk commented on May 11, 2024

Some more progress, now actually able to communicate with the chip. I was able to do this by changing the bootloader to samd21g18a/samd21_sam_ba_both_interfaces.hex

root@rpidev:/home/pi/bootloader# alias gp='gpio write'
root@rpidev:/home/pi/bootloader# alias slp='sleep 0.3'
root@rpidev:/home/pi/bootloader# # on pi, reset atsam (pull RESET pin low)
root@rpidev:/home/pi/bootloader# alias atreset='gp 7 0 ; slp ; gp 7 1'
root@rpidev:/home/pi/bootloader# # on pi, go into atsam bootloader (pull PA15 low during reset)
root@rpidev:/home/pi/bootloader# alias atbootloader='gp 0 0 ; slp ; atreset ; slp ; gp 0 1'
root@rpidev:/home/pi/bootloader#
root@rpidev:/home/pi/bootloader# atreset
root@rpidev:/home/pi/bootloader# ../bossac --info --debug --port ttyS0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
Send auto-baud
Set binary mode
readWord(addr=0)=0x20000470
readWord(addr=0xe000ed00)=0x410cc601
No device found on ttyS0
root@rpidev:/home/pi/bootloader# ../bossac --info --debug --port ttyS0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
Send auto-baud
Set binary mode
readWord(addr=0)=0x20000470
No device found on ttyS0
root@rpidev:/home/pi/bootloader# ../bossac --info --debug --port ttyS0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
Send auto-baud
Set binary mode
readWord(addr=0)=0x20000470
No device found on ttyS0
root@rpidev:/home/pi/bootloader# atbootloader
root@rpidev:/home/pi/bootloader# ../bossac --info --debug --port ttyS0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
Send auto-baud
Set binary mode
readWord(addr=0)=0x20000470
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305

SAM-BA operation failed
root@rpidev:/home/pi/bootloader# ../bossac --info --debug --port ttyS0 --erase --write --verify --reset -U true blinkfirmware.bin
Set binary mode
Send auto-baud
Set binary mode
readWord(addr=0)=0x20000470
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v1.1 Aug 11 2014 20:42:19
chipId=0x10010005
Connected at 115200 baud
readWord(addr=0)=0x20000470
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)

SAM-BA operation failed

from bossa.

shumatech avatar shumatech commented on May 11, 2024

SAMD21 is not officially supported since I do not have a dev board to test it with. If anyone wants to donate a SAMD21 board to the BOSSA project, I'll officially support it and add it to my regression tests done prior to release.

from bossa.

samyk avatar samyk commented on May 11, 2024

I'd be happy to donate a board to support the project. Let me know where you'd like it sent. You can reach me at [email protected].

from bossa.

joaofl avatar joaofl commented on May 11, 2024

I would appreciate the support for the SAMD21 as well.

I've been using this very accessible dev board:
https://www.aliexpress.com/item/Crowduino-M0-SD-Board-for-Arduino-UNO-Micro-Controller-Board-DIY-Kit-Free-Shipping/32712839065.html?spm=2114.13010608.0.0.ViAqDC

from bossa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.