PROBLEM #1:
I have a Pro Micro I have been trying to hookup to my Ham Radio Transceiver. In order to do this I have used a MAX-3232CES, taken the output from the radio and ran it through the MAX3232. The output from that has been patched into the RX1 pin of the Arduino. The radio sends data enclosed in a header which starts with 'FF' 'FF'.
When the radio starts sending on the Arduino all I do is:
void loop()
{
while(RIG.available() > 0)
{
unsigned int val = RIG.read();
Serial.println(val, HEX);
}
}
As far as I can tell the packets from the radio are the correct length, baud rate is set correctly (9600) but the actual output doesn't match. The above code outputs:
80
80
for the the first two bytes of the header, instead of:
FE
FE
None of the data from the radio seems to match, like it is only receiving part of the message. I have tried changing the baud rates, but that doesn't help. Anyone have any ideas? The radio works fine when connected to the laptop.
PROBLEM #2:
Connecting the output from the MAX3232 to the TX0 on the Arduino causes the input to stop working.
RIG.available ? Is that part of some library?
Consider posting your entire sketch (between "code tags") and your circuit.
[Don't be lame - draw it out and take a picture or work it out in Paint, and attach that - see Additional Options, lower left.]
// The computer address is 0x01 and is "hard-coded" since there's only
// one device other than the rig itself on the bus and that is the Arduino
void setup()
{
RIG.begin(9600);
}
void loop()
{
while(RIG.available() > 0)
{
unsigned int val = RIG.read();
Serial.print(val, HEX);
Serial.print(" -- ");
Serial.println(val);
}
}
I have attached the diagram for the MAX 3232 (diagram shows a MAX232 which I have tested and that I have the exact same issue with). So, PIN 13 is connected to RX0 and PIN 14 is connected to TX1 on the Arduino. I am using a surface mount MAX3232 you can see here (bit.ly/1mLLaJq ).
The C5 and the associated coils are to prevent any RFI from entering the circuit. This works just fine, as I have used it, for a laptop.
Not sure on the 'hint'. Are you saying I should use a while-loop to clear out the buffer prior to letting the loop() method continue? Keep in mind the amount of data coming through is 'small' each packet only has 8 bytes at max and there is little to no chatter on the line.
This isn't a laptop.
Perhaps you could explain the merit of jumpering pin 11 to 12.
Loopback?
I think that presents a problem.
if(Serial.available() > 0) // if data from external device presents
{
byte xcvrdatum = Serial.read(); // put the data somewhere
}
Serial.print(xcvrdatum, HEX);
The input requires jumpering as the input is a single line TTL input. The data arrives in NRZ format. I have checked this on the Oscilloscope and it works as described. Jumpering is most probably not the issue. These exact same circuits have been in use for nearly 3 decades and they work just fine.
Not sure why doing the print to the other serial port outside of the IF-statement is an issue - please keep in mind that for the test all the transceiver sends is 10 bytes of information, so overflow of the input buffer is not a problem in the test. However I have tested that, nonetheless and it makes no difference.
The input requires jumpering as the input is a single line TTL input. The data arrives in NRZ format. I have checked this on the Oscilloscope and it works as described. Jumpering is most probably not the issue. These exact same circuits have been in use for nearly 3 decades and they work just fine.
"They work just fine" on something entirely different.
You stated:
"PIN 13 is connected to RX0 and PIN 14 is connected to TX1 on the Arduino"
Pins 13 and 14 of the MAX232 are supposed to go to the RS232 device (the radio, if it's an RS232 compliant port - Is It?)
The Arduino pins are not RS232 at all - they are TTL/5V.
Refer to the dwg in my previous post (Reply #3)
The only MAXx232 pins that have any business going to any Arduino I/O pin are 9, 10, 11, 12