board:cpu: RIOT port for the atsamr21xpro board
List to coordinate porting efforts for the samr21xpro board and it's samd21 cpu. Please leave a comment what you are working on to mark it in the list and open pull requests against ~~https://github.com/thomaseichinger/RIOT/tree/samr21~~ master branch.
Porting todos:
- [x] basic file structure @thomaseichinger
- [x] cortex-m0_common usage @thomaseichinger
- [x] scripts for flashing/debuging (needs newest openocd from git) @thomaseichinger
- [x] LED marcos @thomaseichinger
- [x] set F_CPU correctly
- [x] LPM - under review #2309 @LudwigOrtmann @saurabh984 (cpu has periph/pm)
- [x] peripheral drivers
- [x] UART @thomaseichinger, @Troels51
- [x] timer @thomaseichinger, @Troels51
- [x] GPIO @Troels51, @thomaseichinger
- [x] cpuid @wiredsource
- [x] SPI @Troels51
- [x] I2C @bapclenet
- [x] rtt @daniel-k #2918
- [x] rtc @bapclenet
- [x] pwm ~~#2473~~ #3127 @haukepetersen
- [x] adc - under review ~~#2063 @wiredsource~~ ~~#4162 @msolters~~ Done in #7009
- [x] random number generator (RNG) (#4989)
- [x] PLL @haukepetersen #3034
- [x] radio driver, done, at86rf2xx @haukepetersen ~~(at86rf231 driver works for now, will get at86rf2xx) @thomaseichinger @Troels51~~
- [x] wiki documentation @haukepetersen
Sorry - I should really look where I'm clicking at... :-/
Hey, i'm new to this project but i'm looking into porting RIOT to the board as well. I've been working on gpio and timers
@Troels51, welcome! Great to hear, I marked GPIO in the list with your name.
@thomaseichinger Troels and myself are two of the tree students from Aarhus University. e.g. "[riot-devel] RIOT OS for the Atmel SAM R21 (ARM m0+)" thread
@wiredsource welcome to you too! Are you working on GPIO too?
To give a short update regarding UART, I've some output right now but it is still invalid. Also watch out when configuring GCLK modules, if misconfigured the board isn't reachable anymore via open-ocd and has to be erased using AtmelStudio (AFAIK Windows only).
@thomaseichinger Right now i'm just spectating because i need a better overview over the system. @Troels51 has worked with it for the past week so he has a way better understanding of the architecture.
I will start on something constructive soon :-)
Hi @thomaseichinger I hope you had a good weekend...?
I have a question... What is the status on the UART? We are very excited to know about this one for debugging purposes. @Troels51 have worked on the timers for the last few days and also went around the UART a bit.
But do you have an idea of when it could be ready for test?
Currently I've output from the UART but it is scrambled, I'll have to tweak some parameters regarding clk settings and baudrate. Hope to get it done by tomorrow.
Very good news :+1:
I looked at your uart file earlier and i spotted that you used a baudrate 115200 right? I'm pretty sure the default is 9600. But if theres a problem with the clk it's properly around that one the issue remains...?
@thomaseichinger
I'm trying my luck with the ADC atm :-D
I pushed my latest changes to my repository. It's still not working correctly but I can't see the error right now. Maybe a couple of fresh eyes can spot it.
@wiredsource great, I marked the list entry.
@thomaseichinger
Cool we'll check it out right way.
Regarding the ADC...
- It seems that we'll loose some of the functionalities of the ADC of this board if we use the adc.h interface. This boards adc delivers multiple config possibilities e.g. differential mode, sample accumulation, free running, callback etc...
Would it be possible to perhaps make an ADC extension feature of these configurations? Did this issue not come up with some of the other ADC types?
Any suggestions?
The basic idea of periph/* drivers is to provide a subset of functionality that is common to all platforms in the best case.
This said there is the possibility to implement more advanced features this for this board only besides these interfaces. If it is a matter of configuration, meaning adding a parameter to the initialisation I'd propose you open a PR against periph/adc.hwith suggestions so this could be discussed in more detail.
The UART is working for me right now, i think the clocks were set up in a faulty way.
Sounds awesome - can you send a pointer to your version with working UART?
@OlegHahm Here it is https://github.com/Troels51/RIOT/tree/samr21
@thomaseichinger @OlegHahm
Hi guys!
i'm getting an error while flashing the chip: make BOARD=atsamr21-xpro flash
Building application default for atsamr21-xpro w/ MCU samd21. "make" -C /home/stud/BeeGit/RIOT/cpu/samd21 "make" -C /home/stud/BeeGit/RIOT/cpu/samd21/periph "make" -C /home/stud/BeeGit/RIOT/cpu/cortex-m0_common "make" -C /home/stud/BeeGit/RIOT/boards/atsamr21-xpro "make" -C /home/stud/BeeGit/RIOT/core "make" -C /home/stud/BeeGit/RIOT/drivers "make" -C /home/stud/BeeGit/RIOT/sys "make" -C /home/stud/BeeGit/RIOT/sys/auto_init "make" -C /home/stud/BeeGit/RIOT/sys/lib "make" -C /home/stud/BeeGit/RIOT/sys/ps "make" -C /home/stud/BeeGit/RIOT/sys/posix "make" -C /home/stud/BeeGit/RIOT/sys/shell "make" -C /home/stud/BeeGit/RIOT/sys/shell/commands "make" -C /home/stud/BeeGit/RIOT/sys/timex "make" -C /home/stud/BeeGit/RIOT/sys/uart0 "make" -C /home/stud/BeeGit/RIOT/sys/vtimer text data bss dec hex filename 48732 2260 16748 67740 1089c /home/stud/BeeGit/RIOT/examples/adc_default/bin/atsamr21-xpro/default.elf /home/stud/BeeGit/RIOT/boards/atsamr21-xpro/dist/flash.sh /home/stud/BeeGit/RIOT/examples/adc_default/bin/atsamr21-xpro/default.hex Open On-Chip Debugger 0.9.0-dev-00148-g3a4ec66 (2014-09-19-10:22) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Error: The specified debug interface was not found (cmsis-dap) The following debug interfaces are available: Runtime Error: /usr/local/share/openocd/scripts/interface/cmsis-dap.cfg:7: in procedure 'script' at file "embedded:startup.tcl", line 58 at file "/usr/local/share/openocd/scripts/board/atmel_samr21_xplained_pro.cfg", line 5 in procedure 'interface' called at file "/usr/local/share/openocd/scripts/interface/cmsis-dap.cfg", line 7 make: *** [flash] Error 1
:-(
Do you know how i can fix this???
@thomaseichinger Maybe it makes sense to include the correctly configured version of openocd in dist?
FIXED! This was the problem: No HIDAPI & LIBUDEV
then setting up openocd: ./configure --enable-maintainer-mode --enable-cmsis-dap --enable-hidapi-libusb
ref. http://karibe.co.ke/2013/08/setting-up-linux-opensource-build-and-debug-tools-for-freescale-freedom-board-frdm-kl25z/
@thomaseichinger
I got a working ADC now...
TODOs:
- Refactor mania :-P --> Theres a lot of quick'n'dirty atm
- Comply to coding convention
- ADC extension feature
- Documentation