Pages: [1] 2   Go Down
Author Topic: Transport Control via RS232  (Read 1980 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a CF card recorder that can be controlled by RS232.  I've been trying to control it with this sketch but without any luck:

Code:
int i;
void setup(){
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial2.begin(9600);
  i = 0;

}

void loop(){
  if(i==0){
    Serial2.println("@0?CD\n");
    Serial.println("message sent");
  }
  if(i==100){
    i=0;
  }
  if (Serial2.available()){
    //Serial.print("MIDI:  ");
    Serial.println("we got stuff");
    int inByte = Serial1.read();
    Serial.println(inByte);


  }
    if (Serial1.available()){
    //Serial.print("MIDI:  ");
    Serial.println("serial 1 we got stuff");
    int inByte = Serial1.read();
    Serial.println(inByte);


  }

  i++;
}


I've gone over the manual a few times and this morning stumbled across this:

Quote
1. The host requests data by setting RTS to L.
2. Upon data request by CTS, the PMD570 responds
by setting RTS to H if not busy.
3. The host checks if CTS is H and stats data output
on TxD.
4. When data output finishes, the host sets RTS to H.
5. The PMD570 checks if CTS is H and sets RTS to L.

The shield that I am using only has the following pins:

Tx
Rx
Vcc
Gnd

I would assume that since I am not able to set RTS low that my attempts to controll the device will not succeed.  Is that correct? 


Loren
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you got RS232 level shifters / inverters in-circuit?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure.  I'm not able to find the schematic anymore. 
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure.  I'm not able to find the schematic anymore. 

Then I suggest you find out. If your CF reader needs RS232 and you aren't supplying RS232 signal levels, it's not going to work.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then I suggest you find out. If your CF reader needs RS232 and you aren't supplying RS232 signal levels, it's not going to work.

My next step will be to see if I can generate a schematic by tracing pins.  More to follow on that front...


This is what the manual says in terms of commands:

Quote

Command format
Start character:   @
End character:   0Dh

Notes:
The receiving side ignores data received prior to "@". If code data is received without receiving "@", the data receive error code will be returned. The tolerance for send/receive clock error is ±10%. For sending a command, wait more than 20ms after reception of a response (OK, ERR or Status). Reception of 0Dh or timeout is used to determine the end of a command. Timeout occurs 1 second after the reception of the last byte.




The manual also lists a table of commands and request commands.  This is the one I was trying to use as my test:

Card Condition .............. “@0?CD” + CR

Would the line
Code:
Serial2.println("@0?CD");
fulfill the start and end characters?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your next step should be to find and post a link to the card reader device.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your next step should be to find and post a link to the card reader device.

I think it's been discontinued, but here is a link to the manual:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CFcQFjAA&url=http%3A%2F%2Fwww.jingle.org%2FmarantzPMD570manual.pdf&ei=MM0LUc6KHMy10AH47YGIAg&usg=AFQjCNFUSecX8QBoKGxGHluo-O0MxmSc3Q&sig2=PjQmuONOSwNUyObHL7w_AA&bvm=bv.41867550,d.dmQ
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, that looks fairly conclusive that you need RS232 converters.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The shield that I am using

Is this the CF reader, or something else -and if so, what?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The shield that I am using

Is this the CF reader, or something else -and if so, what?

The shield that I'm using is a TTL to serial converter.  I did find some information.  I cant find a schematic but I think I have some stuff figured out.  Here is a picture:



Here is a close schematic of what I think is going on:


The main difference is that R1 and R2  pictured in the first image (both 1k) are between the TTL and the 232 chip.  The rest of the circuit looks to be the same as the second image.  Would those resisters be throwing a wrench in my works?

Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That picture doesn't show a shield - it shows a PCB. (In Arduino terminology, a 'shield' is a PCB with headers that align with the headers on an Arduino, which is designed to mount on top of the Arduino.)

It looks to me as if that device is designed to use 5-wire RS232 and your RS232-TTL converter provides 3-wire RS232.

I suppose it's possible that you could just pull the RTS (7) low and see whether the PMD570 will receive data. It ought to respond by setting CTS ( 8 ) high, which in your case would make DSR (6) and DTR (4) high - those aren't mentioned in the description of the PMD570 and perhaps it doesn't use them. The main issue I see is that according to your diagram none of these control signals are taken back to the logic level interface so the Arduino doesn't have any way to know whether the PMD570 is ready to receive data. I suppose you could just pull RTS (7) to ground and see if it makes any difference? It would be worth check what the PMD570 does to CTS ( 8 ) in response - hopefully that would confirm that you've identified the connections correctly and I'm reading the description properly.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have connected pin 7 to ground.  And nothing is different.  Thoughts?????


Loren
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would be worth check what the PMD570 does to CTS ( 8 ) in response - hopefully that would confirm that you've identified the connections correctly and I'm reading the description properly.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would be worth check what the PMD570 does to CTS ( 8 ) in response - hopefully that would confirm that you've identified the connections correctly and I'm reading the description properly.

I'm going to check that next.  But first let me ask one more question.  If the manual says this:

Quote
. 1.  The host requests data by setting RTS to L.
2. Upon data request by CTS, the PMD570 responds
by setting RTS to H if not busy.
3. The host checks if CTS is H and stats data output
on TxD.
4. When data output finishes, the host sets RTS to H.
5. The PMD570 checks if CTS is H and sets RTS to L.

Step one seems simple, I should setup a pin as an output and write it low. 
For step two should I wire Pin 8 directly to digital pin?  If so are there steps that I need to take to protect the arduino from getting fried?

Thanks again folks!

Loren
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have both RTS and CTS (pins 7 and smiley-cool connected now and have this code running:

Code:
int i;
#define RTS 22
#define CTS 23

void setup(){
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial2.begin(9600);
  i = 0;
  pinMode(RTS,OUTPUT);
  pinMode(CTS,INPUT);
  digitalWrite(RTS,HIGH);
  Serial.println("Starting");
  delay(1000);
  digitalWrite(RTS,LOW);
  Serial.println("RTS is now low");
 

}

void loop(){
  int state;
  state = digitalRead(CTS);
 
  if(state == 1){
    Serial.println("We have gone High");
  }
  //Serial.println(state);
}

I'm going to double check all the connections but so far the CTS is not going High.

Any thoughts?

Logged

Pages: [1] 2   Go Up
Jump to: