TX/RX pin and serial communication

Hey there,

I'm using a Arduino uno with winXP and I've some trouble since I upload this file ...

#include <Wire.h>
#include <snootor.h>

#define FREQ_MIN 100 // minimal delay to test 
#define FREQ_STEP 50 // delta for each step
#define FREQ_COUNT 20 // number of loops to test
#define START_VELOCITY 3000
// e.g. will test delays 

SnootorStep M;
SnootorStep M2;
int motor_stop=0;
int sens = 0;

void setup(){
  Serial.begin(115200);
  Wire.begin();
  // parameters for init : delay in microseconds/steps per round/motor number (1 or 2)/ mode
  M.init(START_VELOCITY,200,1, MOTOR_MODE_HALFSTEP_VELOCITY);
  M2.init(START_VELOCITY,200,2, MOTOR_MODE_HALFSTEP_VELOCITY);
  
  pinMode(0, INPUT); // setup sensor
  pinMode(1, INPUT);
}

void loop(){
  int count_loop=0;
  int stepperVelocity=START_VELOCITY;
  int colorSensor0, colorSensor1, switchSensor0, switchSensor1;
  Serial.println("start loop...");
  
  colorSensor0 = analogRead(A0);
  colorSensor1 = analogRead(A1);
  switchSensor0 = digitalRead(0);
  switchSensor1 = digitalRead(1);
  

  if(!motor_stop){
    M.goReverse();
    M2.goForward();
  }
  while(!M.stopped()){
    count_loop++;
    SC.delay(200);
    SC.dump();
    if(count_loop>5){
      
      Serial.print("SENSOR VALUE: ");
      Serial.print(colorSensor0, DEC);
      Serial.print (", ");
      Serial.print(colorSensor1, DEC);
      Serial.print (", ");
      Serial.print(switchSensor0, DEC);
      Serial.print (", ");
      Serial.print(switchSensor1, DEC);
      Serial.println(".");
      
      count_loop=0;
      if(sens){
        sens=0;
        M.goForward();
        M2.goReverse();
      }
      else{
        sens=1;
        M.goReverse();
        M2.goForward();
      }
    }
  }
  Serial.println("Stopped");
    
}

As you may understood I've putted a switch button with 10k pullup resistor onto digital pin 0 and 1 which are used for TX/RX serial communication.

So now I'm not able to communicate with the arduino uno anymore. It doesn't do anything right now. Even motors who were working well before are not driven anymore.

The only thing the arduino is doing is going hotter and hotter.

I've tried to upload new boot loader via parallel port using this method: http://www.arduino.cc/en/Hacking/ParallelProgrammer

But this is not working as well.

So my question is, Is there a way to unlock my arduino or should I get a new one ?

Regards

Baptiste

You simply can't utilize pins 0 and 1 for two purposes in the same sketch, one for serial communications and one to read external signals, that is simply an electrical conflict. Leave pins 0 and 1 unconnected and reserved for serial comm and use other I/O pins for your external component connections. If you are not going to be using serial commands then you are free to use pins 0 and 1 as you wish, however even then wiring external stuff to pins 0 and 1 may make it impossible to upload any new sketches unless you disconnect your wiring to pins 1 and 0.
That make sense?

Lefty

Hey Lefty,

Yeah I know this ! It's just that when I did the trick, I didn't realize it was communication pins. So I did disconnect switch button and tried to upload another sketch but I have the trouble I described in my post ...

Baptiste

nanobapt:
The only thing the arduino is doing is going hotter and hotter.

What part on the Arduino board is getting hotter?

sounds like you fried something. You can try to switch the 328 to another board to see if the CPU failed or the board.

@robtillaart: I made the loopback test and all goes well
@James C4S: the arduino itself is getting hotter and hotter

Any guess ?

Baptiste

the arduino itself is getting hotter and hotter

Does that mean the processor or the whole board? The Arduino is the blue board with some chips on it. If the whole board gets hot, you should lower your room temperature :).

And if it still gets hotter and hotter, disconnect it from the power.

@pylon: Yeah Arduino == ATMEGA for me.

Sorry for the confusing sentence ...

It's look like it's running infinite loop ...

The processor of an Arduino doesn't get hot from running a lot of calculations. The only reason for getting hot is supplying too much current to the GPIOs. Probably you have made an error in the wiring or you need to place in a transistor/MOSFET to run to higher current over that element and not the processor.

Some of my Arduinos are running 24/7 always calculating and don't get hot, the temperature rise is not from calculating in the processor.

@pylon : Then why with no connection and no shield the ATMEGA is getting hotter anyway ?

You're absolutely sure that the processor is getting hotter and not the voltage regulator? In most cases that produces temperature problems, the Arduino is powered by 12V. The internal linear voltage regulator burns the 7V down to 5V for the Arduino into heat and over some time, this chip can get quite hot. Because the heat is transmitted to a ground plane on the PCB this heat is distributed over parts of the board and the processor can get warm too.

If really only the processor gets hot and the rest of the board stays cool, your board is defect.

This may help you Plug the uno to your PC load a blink sketch now when it
gets to where it tells program Memory used at the bottom of the IDE press the reset button and let it go.

That should let the boot loader take over. And should program you may have to do more then one time to get the timing right But if you chip didn't
blow the pins TX and RX it should work.

The boot loader starts first then your program so if you reset it will give you a little more time so the boot loader can take over before your program loads.

nanobapt:
I've putted a switch button with 10k pullup resistor onto digital pin 0 and 1 which are used for TX/RX serial communication.

If you had the button pressed so the Tx output was held low (or high - you didn't specify where the other end of the switch was connected) while the Serial port was enabled then you may have overloaded the output driver circuit for that pin. I'm not familiar with the design of that driver circuit, but it's conceivable that it could blow in a way that leaves an internal short circuit between the 5V and ground lines, causing the heating you've reported. I don't know whether it's likely for the Tx pin to damage the driver circuit for the Rx pins but since they're adjacent pins I suppose it may be possible. If the driver for the Rx pin has blown then you won't be able to use the serial port any more so you won't be able to upload any sketches over USB. You may still be able to program it via the ICSP headers.

If you have a scope available and can monitor the state of the Rx and Tx pins, and have a sketch loaded that initialises the Serial port, you would normally expect to see the pins showing either 0V or 5V with clean transitions between them. If the driver has blown, you may see the pin permanently showing 0V or 5V or some intermediate voltage. That would support the theory that the pins have been blown.

nanobapt:
@pylon : Then why with no connection and no shield the ATMEGA is getting hotter anyway ?

If nothing is connected, then you have already damaged the ATmega.

Yeah finally I resolved the problem by putting a new ATMEGA328 ...

The other one seems damage as mentionned. No reply in serial and ICSP programming.

Regards

Baptiste