Device doesn't go to Ground

Hi,

I have to send/receive data to/from a device through serial connection (using Serial1 of an Arduino Mega). The device listens the command once it goes to ground. I've tested that the device works properly using an USB-serial cable (prolific), see attached image. For testing the communication, I'm using the software terminal. Where I send the command $03$02$01$05$F8$03$03 on the part of Macros. I receive the right data.

However, when I want to do the same through Arduino, I don't receive anything. For that, I connect:

  • GND (device) to GND (Arduino)
  • TX (device) to RX1 (Arduino)
  • RX (device) to TX1 (Arduino) - I use a resistor of 4.7K ohm to adapt the voltage
  • PGM (device) to digital Pin 7 (Arduino)

The PGM should go to ground in order to listen the command. See cable connected to the device.

Hence, I configure the pin 7 as OUTPUT and I put it as LOW before sending the command. The command I send through arduino is:

const int A_TEST = 7; // TX from the Micro RF

void setup() {  
  Serial.begin(9600);
  Serial1.begin(9600);  
}

void loop() {
    
  digitalWrite(A_TEST, LOW);
delay (300);
uint8_t message[] = {0x03, 0x02, 0x01, 0x05,  0xF8, 0x03, 0x03};
Serial1.write(message, sizeof(message));
  byte dat;
  if(Serial1.available() > 0)
   {    
    dat=Serial1.read();   
    Serial.print("Received data of size: ");Serial.print(sizeof(dat));Serial.print(" With value (HEX): ");Serial.println(dat, HEX);
   }   
}

I don't receive anything. My questions:

  1. Inserting the pin7 to LOW is like connecting it to ground? I check the current with the multimeter and it is almost 0.
  2. The same command in terminal is the same as the one I'm sending on Arduino? The dollar symbol has some meaning with Arduino?

I'm stuck with this for several days now. Please give some hint on how to solve this.

Thanks

/uint8_t message[] = {0x03, 0x02, 0x01, 0x05,  0xF8, 0x03, 0x03};

Why does that line start with a slash?

Post a link to the datasheet for the device you are trying to talk to.

...R

@PaulS the slash is a mistake writing the post. The real code doesn't have it.
@Robin2. Here the datasheet http://ww1.microchip.com/downloads/en/devicedoc/39626e.pdf

I've tried to send data using serial1.write to my PC using the usb-serial cable (the drivers are correct) but I don't receive the same data as the one transmitted through the terminal software br@y++.

How can I test that the transmitted data from TX1 is well received in my PC?

Is the PIC mcu part of a system, or have you just mounted it on a breakout board? Have you written the program that is on the PIC?

I was (am) hoping to see the specification for the communication program that is running on the PIC - both hardware and software.

Is the PIC operating at 3.3v or 5v?

...R

REM14:
@PaulS the slash is a mistake writing the post. The real code doesn't have it.
. . .

I guess you missed these items in the forum instructions (you did read them, didn't you).

  1. Tips for getting the most out of your post
    . . .
  • Copy and paste code. Don't retype . . .

and

  1. Once you have a response ...
    . . .
  • Except for adding code tags, please don't modify earlier posts to make corrections. That makes the following posts read strangely. Post the modified code in a new reply.

Don