[riot-notifications] [RIOT-OS/RIOT] SAM3: macro LED0_TOGGLE not working (#7613)

Giovanni Milani notifications at github.com
Sun Sep 17 13:09:53 CEST 2017


The LED0_TOGGLE macro for the **arduino-due (SAM3XE)** uses he PIO_ODSR register to toggle led status
https://github.com/RIOT-OS/RIOT/blob/a5bdf0a831868a5e965cef664ad3ca540104e9cd/boards/arduino-due/include/board.h#L39
However this register is read-only unless the corresponding bit in **PIO_OWER** is set.

> 31.5.5 Synchronous Data Output
[...] the PIO Controller offers a direct control of PIO outputs by single write access to PIO_ODSR (Output Data Status Register). Only bits unmasked by PIO_OWSR (Output Write Status Register) are
written. The mask bits in PIO_OWSR are set by writing to PIO_OWER (Output Write Enable Register) and cleared by writing to PIO_OWDR (Output Write Disable Register).

[SAM3XE datasheet pg. 623 p. 31.5.5](http://www.atmel.com/Images/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf)

This fix enables the PIO_OWSR for **all** pins in PIOB, I don't know whether this is the intended behaviour or not. Other possible solutions could be:
- Enabling PIO_OWSR only for LED0 (0x08000000).
- Changing the macro so it uses only SODR and CODR registers.
- Adding a note on the second tutorial (wich uses this macro)

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/7613

-- Commit Summary --

  * Enable all Synchronous Data Output for PIOB by default

-- File Changes --

    M cpu/sam3/cpu.c (3)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/7613.patch
https://github.com/RIOT-OS/RIOT/pull/7613.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/7613
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20170917/1ae9107a/attachment.html>


More information about the notifications mailing list