How to get Wio Terminal High Output Driver Strength

Hi - I noticed I wasn’t getting much current from the outputs (D0-D8) of my Wio Terminal. After some experiments I managed to get higher current from some pins if I used analogWrite instead of digitalWrite.

I post this because it is probably useful to others, but also I would like to know how to get digitalWrite to work from any pin at high current output.

The code below illustrates the problem. I have also verified this by trying to drive an LED from each pin - all pins have ‘normal drive strength’ (DRVSTR=0) when digialWirte is used while some pins have ‘stronger drive strength’ (DRVSTR=1) when using analogue write, but not all.

At normal drive strength my LED is barely lit, the stronger set pins light up the LED vary well - note: my problem is not lighting LEDs, this is only to show the register readback bellow follows actual hardware observations. I just want to be able to rely on getting higher current outputs when I need them for my projects.

analogWrite
(0)-Port 1,Pin 8 : DRVSTR=1
(1)-Port 1,Pin 9 : DRVSTR=1
(2)-Port 0,Pin 7 : DRVSTR=1
(3)-Port 1,Pin 4 : DRVSTR=0
(4)-Port 1,Pin 5 : DRVSTR=0
(5)-Port 1,Pin 6 : DRVSTR=0
(6)-Port 0,Pin 4 : DRVSTR=1
(7)-Port 1,Pin 7 : DRVSTR=0
(8)-Port 0,Pin 6 : DRVSTR=1

digitalWrite
(0)-Port 1,Pin 8 : DRVSTR=0
(1)-Port 1,Pin 9 : DRVSTR=0
(2)-Port 0,Pin 7 : DRVSTR=0
(3)-Port 1,Pin 4 : DRVSTR=0
(4)-Port 1,Pin 5 : DRVSTR=0
(5)-Port 1,Pin 6 : DRVSTR=0
(6)-Port 0,Pin 4 : DRVSTR=0
(7)-Port 1,Pin 7 : DRVSTR=0
(8)-Port 0,Pin 6 : DRVSTR=0

static const uint32_t pin[] = {D0, D1, D2, D3, D4, D5, D6, D7, D8};

void setup() {
  // put your setup code here, to run once:
  int i;
  Serial.begin(115200);
  for(i = 0; i< sizeof(pin)/sizeof(pin[0]); i++) {
    pinMode(pin[i], OUTPUT);
  }
  Serial.println("### Debug Outout Started ###");
  for(i = 0; i< sizeof(pin)/sizeof(pin[0]); i++) {
    // analogWrite(pin[i], HIGH);
    digitalWrite(pin[i], HIGH);
  }
}

void loop() {
  char str[32];
  int i;
  // put your main code here, to run repeatedly:
  
  for(i = 0; i< sizeof(pin)/sizeof(pin[0]); i++) {
    EPortType thisport = g_APinDescription[pin[i]].ulPort;
    uint32_t thispin = g_APinDescription[pin[i]].ulPin;
    
    sprintf(str, "(%d)-Port %d,Pin %d : DRVSTR=%d", i, thisport, thispin, PORT->Group[thisport].PINCFG[thispin].bit.DRVSTR);
    Serial.println(str);
  }
  //exit(0);

}

Steve