Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On AVR-DD Parts can't configure MVIO for Single Supply via Tools MVIO Option in Arduino IDE #506

Open
microPaul opened this issue Jan 3, 2024 · 1 comment

Comments

@microPaul
Copy link
Contributor

I've tested this on the AVR32DD14 and the AVR64DD28. When I configure IDE to disable MVIO (single supply) it seems to ignore my request and the MCU stays in dual supply mode ( Arduino IDE 1.8.13 and the DxCore version 1.5.11). I can't change it using the TOOLS->MVIO option. I've pasted below the small program that I'm using to look at the fuse bits.

MVIO does appear to be controllable for the AVR64DB64 (the only AVR-DB on which I've tried to disable MVIO). However, when I try to set MVIO back to enable (DUAL supplies) for the AVR64DB64 I get the following error from the IDE

avr-g++: error: =-DMVIO_ENABLED: No such file or directory
exit status 1
Error compiling for board AVR DB-series (Optiboot).

And here's my short program to see the fuse bits for MVIO

#undef Serial
#define Serial Serial4

//////////////////////////////////////////////////////////////////////
// SETUP
//
//  This the code to setup the system before running in a main loop.
//
//////////////////////////////////////////////////////////////////////
void setup() {
  // initialize serial port and send a message to the console
  Serial.swap(0); // 
  Serial.begin(57600, SERIAL_8N1);
  Serial.printf("\nMVIO_Status_Report_240103-01\n");
}

 
//////////////////////////////////////////////////////////////////////
// LOOP - This is the main loop of polled functions.
//
//   Loop is not a loop; it's a repetitive call to the function call loop.
//   All local variables will be lost after function ends.
//   If one really wants an "endless loop" then enclose the code in a while(1) loop.
//
//////////////////////////////////////////////////////////////////////
void loop() {
  uint32_t timeRef = 0;
  uint8_t cycleCtr = 0;
  uint8_t val;
  while(1) {
    // this loop never ends    

    // Process runs once every 500 ms
    if (millis() - timeRef > 500) {
      timeRef = millis();

      if (cycleCtr++ & 1) {
        val = (FUSE.SYSCFG1 >> 3) & 0x03; // move MVIO bits down to baseline then mask
        if (1 == val) Serial.printf("MVIO is configured for DUAL power sources, MVIO SYSCFG1 bits are 0x%02x\n", val);
        if (2 == val) Serial.printf("MVIO is configured for SINGLE power source, MVIO SYSCFG1 bits are 0x%02x\n", val);
      }
      else Serial.printf("\n"); // make some time/space differentiation on screen
    }
  }
}
@nomakewan nomakewan mentioned this issue Jan 3, 2024
@nomakewan
Copy link
Contributor

Very odd. The compile error was easy enough to fix (was just duplicated equal signs in boards.txt), but I looked at where the bits are set for SYSCFG1 on both the DB and DD (both with and without optiboot) and they appear to be correct. In all cases, SYSCFG1 is defined as 0b000{mviobits}{sutbits} where mviobits is either 01 for enabled or 10 for disabled, and sutbits are all configured with the three bits according to the datasheets (8ms being 100 for example).

Cross-referencing the AVR DD datasheet with the AVR DB datasheet, it appear that they do indeed have identical SYSCFG1 definitions. So according to boards.txt, they should both be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants