cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Communicate with Programmable Power Supply using SCPI command

qhaoqt
Associate

Hi everyone,

I'm using the STM32F4 Discovery board to communicate with DC Power Supply Programmable ODA OPM Series using RS232.

Now, I can send SCPI commands to device (OUTP ON, OUTP OFF, VOLT 10,...), but when I send some query commands, I can not receive any response from the devices.

I tested to receive data by Hercules and it worked.

Can you help me to resolve this problem.

Best regards.

1 ACCEPTED SOLUTION

Accepted Solutions
qhaoqt
Associate

Thank you for your reply.

I have a problem with my TTL-RS232 module. When I connected VDD on the STM32 Discovery board to VCC on the RS232 module, I could send the signal to the device but not receive any signal. When I connected 5VDC on the board to VCC on the module, it worked.

View solution in original post

2 REPLIES 2
Andrew Neil
Evangelist III

@qhaoqt wrote:

Now, I can send SCPI commands to device (OUTP ON, OUTP OFF, VOLT 10,...), but when I send some query commands, I can not receive any response from the devices.

I tested to receive data by Hercules and it worked.


It's just a matter of sending & receiving text strings.

If it works with a terminal (I presume that's what you mean by "Hercules"?), but not with your code, then there's something wrong with your sending, receiving, or both.

So check where your code differs from what you do in Hercules:

  • Are the physical connections, voltages, etc correct?
  • Are the baud rate, etc, correct?
  • Are you actually sending the correct strings?
  • Pay particular attention to line-endings - CR, LF, CRLF ... ?
  • Is there any indication that the device receives anything at all ?
  • Does the device reply with anything at all ?

 

Instead of connecting your STM32 to the PSU, connect it to your terminal:

  • Do you see in the terminal the correct commands from your code?
    (again, pay attention to line endings)
  • Does your code correctly receive responses you enter in the terminal?

 

When debugging serial comms, it is essential to have some means to observe both what the microcontroller is sending to the device and what the device is sending to the microcontroller - it's a two-way conversation!

https://www.avrfreaks.net/s/topic/a5C3l000000UaFXEA0/t153137?comment=P-1212903

qhaoqt
Associate

Thank you for your reply.

I have a problem with my TTL-RS232 module. When I connected VDD on the STM32 Discovery board to VCC on the RS232 module, I could send the signal to the device but not receive any signal. When I connected 5VDC on the board to VCC on the module, it worked.