VS Arduino
Visual Micro >> General Board >> Writing to/from Registers for SAMD51 Chip Family
https://www.visualmicro.com/forums/YaBB.pl?num=1562635239

Message started by Phillip A. Gonzales on Jul 9th, 2019 at 1:20am

Title: Writing to/from Registers for SAMD51 Chip Family
Post by Phillip A. Gonzales on Jul 9th, 2019 at 1:20am
I am trying to write to the registers on the ATSAMD51J19A on the Adafruit Metro M4 Express.

Trying to use macros such as the AVR lib does with DDRD or PORTD to assign pins on the Uno.

From what I have gathered you need to use the macros found at
C:\Users\[your user name here]\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0\CMSIS\Device\ATMEL\samd51
which is included when you #include "Arduino.h" in a .ino file

However, I am unsure how to implement it as this chip has offsets from base stacks for many of the chips built-in functionalities, unlike the AVR chipsets. 

I am looking at using this method of bit-manipulation within ISR's to optimize the amount of time the code is stuck in the ISR.

Please let me know if anyone out there has been able to utilize any of the many native functionalities present on the SAMD51 via registers.

Title: Re: Writing to/from Registers for SAMD51 Chip Family
Post by Visual Micro on Jul 9th, 2019 at 11:35am
It's quite an advanced discussion. The best place for this question might be the arduino forum or an Atmel forum.

I can say that often these things are defined in \variants folder of each core. Of you find a single file that could be redefined or changed you can override the core by placing a file of the same name in the project and enabling the vMicro>Compiler>Allow overrides menus.

Alternatively whilst the arduino.h might #include some things you can override the main.cpp by including a copy of the main.cpp in your project.

To see the core more easily use "vMicro>Show hidden files".


Title: Re: Writing to/from Registers for SAMD51 Chip Family
Post by Phillip A. Gonzales on Jul 9th, 2019 at 2:26pm
Thank you for the direction, Tim.
I have found a post https://forum.arduino.cc/index.php?topic=334073.0 that seems to do just the trick for the SAMD21 on the Arduino Zero.

The SAMD21 and SAMD51 should be similar enough to be able to understand the logic for register manipulation.

I will be trying to digest the post further later on today and write back.

Title: Re: Writing to/from Registers for SAMD51 Chip Family
Post by Visual Micro on Jul 9th, 2019 at 2:53pm
Yes that looks easier. Thanks

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.