Pages: 1 [2]   Go Down
Author Topic: Serial Port problems  (Read 4029 times)
0 Members and 1 Guest are viewing this topic.
Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear spcomputing,

Thank you. All problems are not totally resolved but I can use the Board. The whole system is very capricious. Sometimes I have an instant communication through COM8, sometimes I have to reboot the computer. Sometimes I lose the connection when uploading a new sketch. Also when uploading a new or a modified sketch, I sometimes have the message saying: “COM 8  busy with another program. Try to uninstall the other program”. Most of the times, holding the reset button while clicking on the ‘Upload’ icon and only then, releasing the reset button helps…but not every times.
Despite those minor nuisances, I like the board and can see its enormous potential for future uses when I shall finally correct those problems.
Next step is to build a Real Time Clock  and use the ‘time’ functions.

Regards

c64
Logged

Chile
Offline Offline
Edison Member
*
Karma: 32
Posts: 1233
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear spcomputing,

Thank you. All problems are not totally resolved but I can use the Board. The whole system is very capricious. Sometimes I have an instant communication through COM8, sometimes I have to reboot the computer. Sometimes I lose the connection when uploading a new sketch. Also when uploading a new or a modified sketch, I sometimes have the message saying: “COM 8  busy with another program. Try to uninstall the other program”. Most of the times, holding the reset button while clicking on the ‘Upload’ icon and only then, releasing the reset button helps…but not every times.
Despite those minor nuisances, I like the board and can see its enormous potential for future uses when I shall finally correct those problems.
Next step is to build a Real Time Clock  and use the ‘time’ functions.

Regards

c64


Are you using 1.0.1 right?

I am experiencing troubles with the serial port also, never had issues with 0023 (besides some delays with bt devices) but now the menu is constantly grayed out... I tried updating the 8u2 to the rev0003, but after some  uploads I got the same  issue. Very annoying, the only workaround I found is to change the com port number every time this happens.

Logged

My website: http://ried.cl

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Another silly idea is to put a 2.0 USB Hub.  Someone else had the same issue and moved from the front PC USB access ports to the back and fixed it.  Something is fighting in the MS USB Driver based on the motherboard hardware.  I had a machine that was fighting with the mouse on an old notebook and blam, all fighting gone.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am having a similar problem with the serial port on my Arduino Uno, Rev 3, that is being discussed in this thread.  When I try to run a program on the Arduino, I get the error the error message: "Serial port "COM3' not found. Did you select the right one from the Tools > Serial Port menu?"
When I go to the Tools > Serial port menu, it is greyed out.  In reading the other posts to this thread, I noticed that, at one point, someone asked another member:  "Do you hear the beep sound when you plug in the Uno to the computer?"  My answer to that is: No, I do not get this sound.  When I look at the device manager, it shows the Uno as being an "unknown device."  Does this mean I should download the proper driver for the Uno?  Will this solve the problem?
Logged

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you try eried's modded IDE?

https://github.com/downloads/eried/Arduino/setup_Arduino_ERW_1.0.1i_20121020.exe
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

spcomputing:
     I tried to download the link you provided, eried's modded IDE, but my computer blocked it...the computer didn't give me the option to override the block.  Is there some other way to get this IDE?
     Thanks,   Dexter
Logged

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you disable it thru the taskbar for 10 minutes?  Usually it is the antiviral's company logo, right click and control option.  It is just because of the .exe extension, so you are going to need to take the protection down for a few minutes.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

spcomputing:
     That worked!  Thank you.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to run this sample program, http://www.robot-electronics.co.uk/files/arduino_md25_serial.ino , which I got from the Devantech website.  My hardware is hooked up as in this diagram: http://www.robot-electronics.co.uk/htm/arduino_examples.htm#MD25 RD02 Motor Controller serial  (Scroll down to the "MD25 RD02 Motor Controller Serial.")  The program compiles correctly, but when I upload it, nothing happens to the motor or LCD screen...it all just sits there and does nothing.  Is it waiting for a button-push or something?  How do I get the motors running, using this code?  I only have 1 of the 2 motors hooked up.
Logged

California
Offline Offline
God Member
*****
Karma: 13
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tested with another sketch like blink (change the delay from 1000 to 500 to be sure)?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tested it with Blink, and the Arduino worked.  However, the Arduino Uno only worked when I had no other wires connected to it, besides the USB.  Once I hooked it up as in the setup I gave in a previous post...http://www.robot-electronics.co.uk/htm/arduino_examples.htm#MD25 RD02 Motor Controller serial , then, the Uno would not respond to any changes I made in the blink program (i.e., changing from 3 seconds to 5 seconds).  When I would upload another program, the Uno's various LED's would blink rapidly for 1 or 2 seconds, acknowledging that it was receiving new instructions, but then it would just blink the LED to the last uploaded interval that I had uploaded (when it was connected to nothing but the USB).  It seems like it won't take any new instructions unless it is connected to only the USB cable.  How do I get it to accept new programs?
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem is you can't have Pin 0 Rx and 1 Tx hooked up to the motor controller board the same time you are trying to uploading the sketch.  Those same pins are being used by the USB port communications.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hiduino,

     Much thanks!  That worked, and now the program is running.

     --Dexter
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The program worked a few times, but now it is not working again.  My hardware is setup to use the RD02 MD25 serial circuit, as shown here:
http://www.robot-electronics.co.uk/htm/arduino_examples.htm#MD25 RD02 Motor Controller serial     and I'm using the code shown below.  I followed the suggestion given earlier, i.e., unhooking Rx and Tx when uploading the program through the USB (and then reconnecting Rx and Tx after the program is uploaded).  Now the LCD03 does not show either.  The LCD03 displays the message "LCD03 REVISION 9   SERIAL MODE", but then the screen goes blank when I run the code shown below.  I used to get a readout on the LCD03 of motor statisitics, but now the LCD goes blank and the motors don't move when I upload the code.  Is there some kind of memory buffer or limit I'm running into?  Like I say, the motors ran for about 3-4 times, but then stopped -- that is I uploaded the code 3 or 4 times, and each time it ran, but then after the 3-4 uploads, the motors didn't run anymore.  I must have changed something for this to happen, but I left everything the same.  Here is the code I'm using:



Code:
/****************************************************************
*                    Arduino MD25 example code                  *
*                   MD25 running in serial mode                 *
*                                                               *
*                     by James Henderson 2012                   *
*****************************************************************/

#include <SoftwareSerial.h>

// Values of 0 being sent using serial.write() have to be cast as a byte to stop them being misinterpereted as NULL
// This is a bug with arduino 1
#define CMD                 (byte)0x00              //  MD25 command byte of 0

#define WRITESP1            0x31                    // Byte writes speed to motor 1
#define WRITEACCEL          0x33                    // Byte writes a value of acceleration
#define RESETREG            0x35                    // Byte resets encoders
#define SETMODE             0x34                    // Byte sets mode
#define READIVS             0x2C                    // Byte reads motor currents and battery voltage        
#define READENCS            0x25                    // Byte reads both encoders
#define GET_VER             0x29

#define LCD_RX              0x02                    // RX and TX pins used for LCD0303 serial port
#define LCD_TX              0x03
#define LCD03_HIDE_CUR      0x04
#define LCD03_CLEAR         0x0C
#define LCD03_SET_CUR       0x02

SoftwareSerial lcd03 = SoftwareSerial(LCD_RX, LCD_TX);          // Define the serial port for the LCD03

long encValue = 0;
byte softwareRev = 0;

void setup(){
  Serial.begin(38400);
  lcd03.begin(9600);
  
  Serial.write(CMD);                                            // Set MD25 accelleration value
  Serial.write(WRITEACCEL);
  Serial.write(10);
  delayMicroseconds(10);                                        // Wait for this to be processed
  Serial.write(CMD);                                            // Reset the encoder registers to 0
  Serial.write(RESETREG);        
  Serial.write(CMD);                                            // Set mode to 2, Both motors controlled by writing to speed 1
  Serial.write(SETMODE);
  Serial.write(2);    
  
  Serial.write(CMD);                                            // Get software version of MD25
  Serial.write(GET_VER);
  while(Serial.available() < 1){}                               // Wait for byte to become available        
  softwareRev = Serial.read();  
  
  lcd03.write(LCD03_CLEAR);                                     // Clear the LCD03 screen
  lcd03.write(LCD03_HIDE_CUR);                                  // Hide the LCD03 cursor
}

void loop(){
  while(encValue < 3000){               // While encoder 1 value less than 3000 move forward
    Serial.write(CMD);                  // Set motors to drive forward at full speed
    Serial.write(WRITESP1);
    Serial.write(150);
    encValue = readEncoder();
    readVolts();
  }
  delay(100);
  while(encValue > 100){
    Serial.write(CMD);                  // Drive motors reverse at full speed
    Serial.write(WRITESP1);
    Serial.write(100);
    encValue = readEncoder();
    readVolts();
  }
  delay(100);
}

long readEncoder(){                        // Function to read and display the value of both encoders, returns value of first encoder
  long result1 = 0;
  long result2 = 0;
  Serial.write(CMD);
  Serial.write(READENCS);
  while(Serial.available() < 8){}          // Wait for 8 bytes, first 4 encoder 1 values second 4 encoder 2 values
  result1 = Serial.read();                 // First byte for encoder 1, HH.
  result1 <<= 8;
  result1 += Serial.read();                // Second byte for encoder 1, HL
  result1 <<= 8;
  result1 += Serial.read();                // Third byte for encoder 1, LH
  result1 <<= 8;
  result1  += Serial.read();               // Fourth byte for encoder 1, LL
  result2 = Serial.read();
  result2 <<= 8;
  result2 += Serial.read();
  result2 <<= 8;
  result2 += Serial.read();
  result2 <<= 8;
  result2 += Serial.read();

  lcd03.write(LCD03_SET_CUR);              // Set the LCD03 cursor position
  lcd03.write(21);
  lcd03.print("Encoder 1:");               // Displays data to the LCD03 screen
  lcd03.print(result1,DEC);
  lcd03.print(" ");                        // Print a blank space to clear any unwanted characters that are leftover on the LCD03 display
  
  delay(5);                                // Delay for LCD03 to process data
  
  lcd03.write(LCD03_SET_CUR);
  lcd03.write(41);
  lcd03.print("Encoder 2:");
  lcd03.print(result2,DEC);
  lcd03.print(" ");
  return result1;                                  
}
  
void readVolts(){                                                 // Function reads current for both motors and battery voltage
  byte batteryVolts, mot1_current, mot2_current = 0;
  Serial.write(CMD);
  Serial.write(READIVS);                                          // Send byte to readbattery voltage and motor currents
  while(Serial.available() < 3){}                                 // Wait for the 3 bytes to become available then get them
  batteryVolts = Serial.read();
  mot1_current = Serial.read();
  mot2_current = Serial.read();

  lcd03.write(LCD03_SET_CUR);
  lcd03.write(61);
  lcd03.print("Mot1 I:");
  lcd03.print(mot1_current,DEC);
  lcd03.print(" Mot2 I:");
  lcd03.print(mot2_current,DEC);
  lcd03.print(" ");
  
  delay(5);
  
  lcd03.write(LCD03_SET_CUR);
  lcd03.write(1);
  lcd03.print("Rev:");
  lcd03.print(softwareRev, DEC);
  lcd03.print(" ");
  lcd03.print("Volts:");
  lcd03.print(batteryVolts/10,DEC);                               // Seperate whole number and descimal place of battery voltage and display
  lcd03.print(".");  
  lcd03.print(batteryVolts%10,DEC);
  lcd03.print(" ");  
}


Moderator edit: [code] [/code] tags added.
« Last Edit: November 14, 2012, 05:11:36 pm by Dexter7 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Preogress report:  I got both motors to run now.  I replaced one of the motors that went bad.  It may have gone bad because I spliced in an extra 10 inches of wire....or it could have gone bad because I set the acceleration value too high in the software.  I'll have to check on this.
Logged

Pages: 1 [2]   Go Up
Jump to: