MKRZERO to Due REG_PORT_OUT0 Error

Hi, I am fairly new to Arduino so please excuse me if this is a very obvious issue. I have searched this forum but haven't found an answer.

I have written my code to work on the Arduino MKRZERO but I have decided to switch to the Arduino Due. When I compile the code I am presented with this error: 'REG_PORT_OUT0' was not declared in this scope. My suspicion is that this is declared when I choose my board as MKRZERO but it is not declared for the Due.

What is the equivalent variable for the Due? What should I replace 'REG_PORT_OUT0' with?

Please let me know if I need to clarify or add more information.

Thank you.

What IDE are you using? If it's Platformio, did you include #include "Arduino.h"?

I'm using the official Arduino IDE version 1.8.19

If this is a SAM processor, you might need to use PIO stuff. I've just been through it in a different thread:

This might help, or confuse you. I had a lot of trouble with GPIO as well.

Hi @harshran

One disadvantage of accessing the microcontroller's registers directly, is that unlike Arduino code, the program usually isn't portable between different boards.

In this case, the MKR Zero's SAMD21 register definition REG_PORT_OUT0, doesn't exist on the Due's SAM3X8E microcontroller.

Definitely over my head but what I do understand is that the code isn't going to be the same since it's a different microcontroller. Thanks for your input. I'm going to go back and try to learn more about the SAM processor.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.