3 Replies Latest reply on Sep 10, 2019 8:08 AM by mrkevin

    Did i code brick my Arduino uno?

    supper_slash

      Arduino no longer shows up on a COM port.

       

      I am working on a 200khz 50% waveform generator.

       

      I was working on a sketch and then running the arduino over to my scope to find out where I am at.

      I managed to get it to 250khz with this sketch and all was well.

       

      #include <avr/io.h>
      #include <util/delay.h>
      
      
      int main(void)
      {
        pinMode(3, OUTPUT); // output pin for OCR2B
        pinMode(5, OUTPUT); // output pin for OCR0B
      
      
        // Set up the 250KHz output
        TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
        TCCR2B = _BV(WGM22) | _BV(CS20);
        OCR2A = 63;  //This is the reset point out of 255 count setting the frequency to 200khz.
        //The higher the number in "OCR2A" the lower the Frequency.
      
      
        OCR2B = 0;  //This sets the duration of the pulse, half of the above number is = to 50% on time.
      }
      // Set up 8MHz output
      //TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00);
      //TCCR0B = _BV(WGM02) | _BV(CS00);
      //OCR0A = 1;
      //OCR0B = 0;
      
      
      // Make the 250KHz rolling
      //while (1) {
      //_delay_us(5);
      // if ( OCR2B < 63 )
      // OCR2B += 5;
      // else
      //   OCR2B = 0;
      // }
      //}
      

       

      It was working fine, I plugged it back in and changed line 14, to: "OCR2A = 51;  //This is the reset point out of 255 count setting the frequency to 200kHz.".

      And line 18 to "OCR2B = 26;  //This sets the duration of the pulse, half of the above number is = to 50% on time.".

       

      And now the led's light up on the board, but there is no out put on any pins. Also when I reconnect it to the USB, it will not show up on any com port...

      I am running win 10, and I tried another Arduino on the same cord, and USB port and it works fine. I shows up on com4.

      So before I try and upload this code to the new board does anyone see anything in the code that can harm the arduino?

        • Re: Did i code brick my Arduino uno?
          clem57

          The code did not brick the Uno. But if the boot-loader is gone(?), you can use the other working Uno to load a new boot-loader to the bad Uno. Try that and see if the Uno works again.

          Clem

          • Re: Did i code brick my Arduino uno?
            mcb1

            The USB connetivity should be done via the USB chip, rather than the Atmel 328 chip.

             

            Three questions.

            1. Does it show in whatever operating system you are using as a connected device (ignore the Arduino IDE)
            2. Will it show if you hold down the reset button and plug it in, and kppe holding the reset button down.
            3. Do you have any wires, etc connected to D0 and D1.

             

            The reset button stops the code from running, and in some cases I've seen the program code take over the serial out.

            Anything conneted to Pin D0,1 may hold the pin down and stop the serial communication.

             

            Mark

            4 of 4 people found this helpful
            • Re: Did i code brick my Arduino uno?
              mrkevin

              This problem can occur due to 3 problems:
              1. RX and TX Pins attached while uploading sketch
              2. Port not selected.
              3. Arduino Bricked
              Solutions:
              1. Disconnect TX and RX Pins while uploading arduino.
              2. Select port.
              3. Use another arduino to upload program on it if it is bricked.
              For more information look into this article: Programmer is not responding arduino






              4 of 4 people found this helpful