bobc / bare-metal-sam3x Goto Github PK
View Code? Open in Web Editor NEWBare bones projects for SAM3X (Arduino Due)
License: MIT License
Bare bones projects for SAM3X (Arduino Due)
License: MIT License
For programming my Due with a Raspberry Pi I reset it with
stty -F /dev/ttyACM0 1200
Then I can flash it with bossac.
According to the datasheet the watchdog timer is enabled by default after a power-on reset. It's set to ~ 16 seconds after which it will reset the board (section 15.4 on page 261). If you're just blinking an LED like in this example especially with a long period then you are unlikely to notice it fire and reset the board. I spent an hour debugging my own bare metal program trying to figure out why it was resetting at such a consistent uptime before I figured this out. You can disable it on boot with:
static uint32_t* const WDT_MR = (uint32_t*) 0x400E1A54;
void main() {
// watchdog timer is actived on boot with a default timeout so disable it
// note: you can only write to WDT_MR once after power on reset
// Atmel SAM3X8E Datasheet, section 15.4, page 261
*WDT_MR |= (1 << 15); // WDDIS (watchdog disable) bit, page 265
// ... omitted ...
}
Hopefully this helps the next person who comes along and tries to use this project as a starting point from having to debug the same issue.
Just wanted to let you know that only version 1.7 of bossac will work to flash the Arduino Due. Since 1.8 was released not only older versions won't work, even the newer version seems to be broken for this device.
Btw i want to thank you for the hint with the version issue. I was trying to get the Due running with minimal bare metal startup code for days and already started to wonder why even the easiest examples are not running, even if same bossac version worked sucessfull with the arduino libarary. Truly the size seems to be a good explenation for this strange behaviour, since the binary is about 30 to 40kB with, and just some hundreds of bytes without the library.
Best regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.