Help Understanding digitalWrite problems

Hello,

I am using a custom screen with an ILI9488 chip attached to an Arduino Zero board. I have many Zero boards and I am only seeing this problem on a couple of them, even with the same code. It has something to do with the PWM lines coming from the chip (used to register touches), but I am unsure how to troubleshoot this.

I created a small example just to try to figure out the issue. This code works on about half of the boards:

void setup() {

  uint8_t _yp = 18; //PB08
  uint8_t _ym = 16; //PA05
  uint8_t _xp = 17; //PA04
  uint8_t _xm = 15; //PB09
  
  
  SerialUSB.begin(115200);
  while (!SerialUSB);
  SerialUSB.println("Serial initialized...");
  
  pinMode(_yp, INPUT);
  pinMode(_ym, INPUT);
  pinMode(_xp, OUTPUT);
  pinMode(_xm, OUTPUT);

  SerialUSB.println("pinMode set successful");

  SerialUSB.println("Write xp high");
  digitalWrite(_xp, HIGH);
  SerialUSB.println("Write xm low");
  digitalWrite(_xm, LOW);

  SerialUSB.println("Finished");  
  

}

void loop() {
}

Every time I run this code with a defective board, it freezes as soon as I try to perform a digital write. It also freezes when I try to change the value of the port pointer directly. When I run it with a non-defective board, the code completes.

When I unplug the screen, this code works runs through completely every time.

Interestingly enough, when I turn off the SerialUSB initialization, the board will just continuously reset itself when arriving at the digitalWrite line.

Does anyone have any insight on what may be causing this with some of the boards?

Thanks!

masoandro:
Does anyone have any insight on what may be causing this with some of the boards?

Short circuit.

This was one of my guesses as well. Although after testing the pads for connectivity, I cannot find it. Unless they are unrelated to the PWM lines.

Put 220 Ω resistors between the two (except power and ground). Measure the voltage across the resistors.

It’s been a while. But I tried this on a good board, everything initializes fine and I measure ~1.3V between the two points.

On the bad board, it freezes when trying to write HIGH. I do not measure any voltage across the two points.

masoandro:
This was one of my guesses as well. Although after testing the pads for connectivity, I cannot find it. Unless they are unrelated to the PWM lines.

Will probably still be a short, but perhaps one that only happens when the defective ILI9488 is powered up?