I have a couple custom SAMD21 boards (similar to Arduino Zero) connected to a screen from which I am trying to read PWM screen touch signals. The two boards are identical - same components and same setup. The PWM lines are run from the MCU to a connector and then to the screen. There are no components on the PWM line (there can be an optional ESD suppresor but I have unmounted it for now). On one board, I do not experience any problems - the screen works, touch signals are received and processed accordingly. On the other board, the PWM does not work at all, in fact, the digital pins used to control it do not work at all. The PWM lines are hooked up at PA04 (Digital Pin 17) and PB09 (Digital Pin 15). When I try to write a value (high or low) to one of these registers, the code freezes. When I remove the screen, the problem goes away.

I set up an example, which just involves writing a HIGH signal to one pin and a LOW signal to the other. So I took the two PWM pins (15 and 17) and connected them with a 220ohm resistor. On the functioning board, everything works, the code completes, and I read about 1.3V between the two.

But on the bad board, using the same setup with the 220ohm resistor, the board freezes in the same way as with the screen. Removing the connection (including the resistor) clears the error.

Is there a way inside the firmware to correct this? The operation is so simple and it freezes even when I try to write directly to the register - meaning I can't check the rdy bit for completeness while the pointer operation is not complete. Should hardware components be added the digital IO lines? I am unclear on how to proceed given that one identical setup works and the other does not.

Thank you very much for any help!

void setup() {

  uint8_t _yp = 18; //PB08
  uint8_t _ym = 16; //PA05
  uint8_t _xp = 17; //PA04
  uint8_t _xm = 15; //PB09

  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);


void loop() {
  • consider the possibility that the failing board is actually the good one and the board that works is actually defective ..... i have seen an instance when a defect prevented the board from failing ...... maybe you have two pins shorted on the screen ...... one of the pins is blown on the board that works
    – jsotola
    Commented Apr 2, 2019 at 3:19
  • I certainly hope not. I've made about 350 of these so far. I've checked the screen for shorts, and even removed one of the components I suspected of causing a short. Today I also swapped the two MCUs - the error carried itself along with the chip to the other board..
    – Andrew
    Commented Apr 2, 2019 at 4:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.