bl4s200 serial port C issue

I am using BL4S200 and program RS485 in port C. the baud rate is 115200. However, I have very strange things. As soon as I connect programming/diag port and my program is working properly, and i also can use usb-to-Rs485 serial cable to communicate with my HMI. but if I remove programming cable and download program into flash memory and power off/on, I can’t make any connection between my hmi and controller via serial RS485. anybody can give me some hint?

Make sure you’re compiling your program to flash on the BL4S200 (and not RAM). Also make sure you have a proper ground connection in your RS485 wiring. The programming cable might be providing a missing ground.

Are you able to confirm that your program is running and it’s just the RS485 interface that’s not working?

Hello, Tom:

Thank you for your information. Actually, I confirm the program in the flash memory because my program trigger some digital i/o after program start up and also I have rs232 in the same board to communicate to another board, and 232 communication is working. also I use the same USB-to-rs485 converter with ground connection to do communication. By the way, I have question for DC-COM and GND for BL4S200,I found out GND terminal on RS485 port and DC-COM from power supply are connected, and also I notice on cpu board, One pin on programming port is connected to ground ring hole on cpu board and the same as the case of ethernet. So they are grounded. Do you think in this case do I need to connect DC-COM to ground?

I’m really not sure – I’m a software guy and not a hardware guy. Does your program work after power cycling when the “DIAG” connector of the programming cable is connected? But then fail if that DIAG cable is not present?