2037 views|35 replies

194

Posts

0

Resources
The OP
 

The serial port assistant can receive commands, but when connected to the light source, the light source does not respond. Why? [Copy link]

 

Make a button to control the brightness of the light source, and then press the button. The serial port assistant can also receive the data command, but if I connect the light source, the light source does not respond. I connect the light source to the computer and use the serial port assistant to send this command twice. The light source can be turned on and off. Why is there no response when the button controls the light source connection? The button control light source command is the same as the sent command, but there is no response. What is the reason?

This post is from Test/Measurement

Latest reply

The code is really long   Details Published on 2024-1-25 16:08
 
 

2w

Posts

0

Resources
2
 

[The button control light source command is the same as the sent command]

Logically speaking, your [button control light source command] must be different from the [sent command]. If they were the same, it should work normally and you wouldn't be on the forum.

[Different] Even the plug and socket are not properly plugged in.

This post is from Test/Measurement

Comments

[attachimg]772701[/attachimg]This is the command sent by the serial assistant after the light source is connected to the computer. The light source can be lit. [attachimg]772702[/attachimg] This is the command received by the serial assistant when I press the button to control the light source circuit to connect to the computer. However,  Details Published on 2024-1-11 11:41
 
 
 

5998

Posts

6

Resources
3
 

How is the light source powered? Check if it is a power problem.

This post is from Test/Measurement

Comments

The power supply is normal  Details Published on 2024-1-11 11:47
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

194

Posts

0

Resources
4
 
maychang posted on 2024-1-11 10:52 [The key control light source command is the same as the command sent] Logically speaking, your [key control light source command] must be the same as the [command sent] ...

This is the command sent by the serial assistant after the light source is connected to the computer. The light source can be lit. This is the command received by the serial assistant when I connect the light source circuit to the computer with the key control. However, the light source does not respond when my key control light source circuit board is connected to the light source

This post is from Test/Measurement

Comments

How can a button-controlled light source circuit send several packets of data at a time?  Details Published on 2024-1-15 09:46
 
 
 

194

Posts

0

Resources
5
 
Qintianqintian0303 posted on 2024-1-11 11:01 How is the power supply of the light source? Check if it is a power supply problem

The power supply is normal

This post is from Test/Measurement
 
 
 

6818

Posts

11

Resources
6
 

First of all, you need to understand the communication protocol, what do the bits mean, is there CRC, etc. I suggest you elaborate on the problem so that the experts will know how to help you.

Also, after pressing the key, is the baud rate of your serial port output correct? Have you used a logic analyzer to check if it is correct? Sometimes the baud rate of the computer and the waveform of the microcontroller may not be correct.

Please upload the waveform (preferably an oscilloscope), logic analyzer, and other data, otherwise everyone will just guess at the answer, which is meaningless.

This post is from Test/Measurement
 
 
 

6742

Posts

2

Resources
7
 

Are the flow control pins enabled?

This post is from Test/Measurement

Comments

Not enabled  Details Published on 2024-1-11 14:55
 
 
 

194

Posts

0

Resources
8
 
wangerxian posted on 2024-1-11 14:38 Is the data flow control pin enabled?

Not enabled

This post is from Test/Measurement

Comments

Are both the receiving and sending ends programs written by yourself?  Details Published on 2024-1-12 17:27
 
 
 

2w

Posts

341

Resources
9
 
This post was last edited by qwqwqw2088 on 2024-1-11 21:24

When the button is pressed, the serial port assistant can also receive data commands.

Check whether the key serial port configuration is correct, and whether the baud rate, number of bits, stop bits, and check bits are correct.

Can receive data commands, the serial port may not be opened or occupied.

This post is from Test/Measurement
 
 
 

194

Posts

0

Resources
10
 
qwqwqw2088 posted on 2024-1-11 21:23 When the button is pressed, the serial port assistant can also receive data instructions. Check whether there is any problem with the configuration of the button serial port, baud rate, number of bits, stop...

I set up

in CUBEMX. PA9 and PA10 PA2 and PA3 are connected to the serial screen. The key device and the light source device can communicate normally with the computer serial port assistant, but these two devices cannot communicate. The command sent by the light source device must be sent twice before it can be executed. This is the command received by the key device . When the key is pressed, it is a high level, and the baud rate is set to 115200. It is strange that the two devices cannot communicate. Another problem with the key device is that if I don't press the key, it can automatically receive the key output command.

This post is from Test/Measurement

Comments

Two devices cannot communicate? Why do I feel it is a hardware connection problem?  Details Published on 2024-1-12 20:43
 
 
 

6742

Posts

2

Resources
11
 

Are both the receiving and sending ends programs written by yourself?

This post is from Test/Measurement

Comments

It is not just about writing the program for the button light source control circuit. The program for connecting the light source circuit has already been written by others.  Details Published on 2024-1-15 08:54
 
 
 

2w

Posts

341

Resources
12
 
xbxdbd posted on 2024-1-12 09:06 I set up two serial ports in CUBEMX, PA9 and PA10 PA2 and PA3 are connected to the serial port screen, the button settings...

Two devices cannot communicate?

Why does it feel like a hardware connection problem?

This post is from Test/Measurement

Comments

Hardware connection? What could be the reason?  Details Published on 2024-1-15 08:51
 
 
 

194

Posts

0

Resources
13
 
qwqwqw2088 posted on 2024-1-12 20:43 The two devices cannot communicate? Why does it feel like a hardware connection problem?

Hardware connection? What could be the reason?

This post is from Test/Measurement
 
 
 

194

Posts

0

Resources
14
 
wangerxian posted on 2024-1-12 17:27 Are both the receiving and sending end programs written by yourself?

It is not just about writing the program for the button light source control circuit. The program for connecting the light source circuit has already been written by others.

This post is from Test/Measurement

Comments

Then you can change it, just change it to the same serial port configuration.  Details Published on 2024-1-15 09:17
 
 
 

6742

Posts

2

Resources
15
 
xbxdbd posted on 2024-1-15 08:54 It is not just a program for the key light source control circuit. The program for connecting the light source circuit has been written by others.

Then you can change it, just change it to the same serial port configuration.

This post is from Test/Measurement

Comments

I have seen the serial port configuration [attachimg]774594[/attachimg] The following figure is the key serial port configuration [attachimg]774595[/attachimg]   Details Published on 2024-1-15 09:33
 
 
 

194

Posts

0

Resources
16
 
wangerxian posted on 2024-1-15 09:17 Then you can change it, just change it to the same serial port configuration.

I have seen the serial port configuration

The following figure is the key serial port configuration

This post is from Test/Measurement
 
 
 

6742

Posts

2

Resources
17
 
xbxdbd posted on 2024-1-11 11:41 This is the command sent by the serial port assistant after the light source is connected to the computer. The light source can be lit. This is my key control of the light source...

How can a button-controlled light source circuit send several packets of data at a time?

This post is from Test/Measurement

Comments

Yes, and it should be that the button is pressed once, and the serial assistant receives the data, but this is not the case. It starts with 0000, and then I press SW1, it sends data, and sends a series of repeated data. In theory, pressing SW1 again should receive the data of the LED off command, but there is no response, and then I don't press  Details Published on 2024-1-15 11:07
 
 
 

194

Posts

0

Resources
18
 
This post was last edited by xbxdbd on 2024-1-15 11:12
wangerxian published on 2024-1-15 09:46 How to send several packets of data at a time using a button to control the light source circuit?

Yes. And it should be that when the button is pressed once, the serial assistant receives the data, but this is not the case. At the beginning, it is 0000. Then I press SW1 and it sends data, and sends a series of repeated data. Logically, when I press SW1 again, it should receive the data of the LED off instruction, but there is no response. Then, if I don't press the button, it keeps receiving data automatically. I'd like to know what's going on, because this is my first time writing code. This is the button program.

This post is from Test/Measurement
 
 
 

6742

Posts

2

Resources
19
 

Did you process the 00 data at the beginning when your serial port receives it? You can use the serial port tool to send a lot of 00s first and then send the command to see if you can control it successfully.

This post is from Test/Measurement
 
 
 

6742

Posts

2

Resources
20
 

If control fails, it means there is a problem when parsing the serial port data.

This post is from Test/Measurement

Comments

I tried it. First I asked it to send a lot of 00s, then I pressed the sw1 button, and it could receive the command from SW1, and then it kept receiving automatically. It shouldn't be like this. It should be that each press should receive a data command. Then I tried to press sw1 again, and it should receive the command to turn off the light, but  Details Published on 2024-1-15 14:46
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list