6732 views|8 replies

18

Posts

0

Resources
The OP

Urgent need CH559 serial port can receive the program [Copy link]

This post was last edited by mig29ee on 2018-4-30 22:53 Does anyone have a program for serial port reception with 559? I expected that setting various registers would be a pitfall, and the programming life of 554 was short, so I played with 559 first, and I really got stuck in the pit. . . . First, I set Timer0 to 1mS interrupt according to habit, but the slowest clock can only be Fsys/12 = 1M, so it is necessary to follow the 16-bit mode and reload in the interrupt. If you want to be precise, you have to check the assembly instruction cycle. I had to set it to 8bit automatic reload, which can accurately obtain 250uS interrupts, and then the baud rate of UART0 changed from 57600 to 14400, which is not a big problem. However, when PWM is integrated, it does not work. . . When ADC is added alone, the Key is invalid again. . So I thought of checking the register value, and then I thought of transplanting ISD debugging, which failed (PC sent 0xA5, no response, and used LA to find that the Rx0 pin was continuously '1'). I had to take another step back: test UART0 Demo, and found that it can still only send, not receive! ch559_UART0_NG.C (2.18 KB, downloads: 2) I looked at the program and found that mInitSTDIO() did not set the IO pins. So I looked at the Datasheet and added the following code (P3.1 output, P3.0 pull-up input), but it still didn't work PORT_CFG = 0xF5; //0bxxxx 0101 P3_DIR = 0x02; //0b0000 0010 --> P3.1 is Tx_out, P3.0 is Rx_In P3_PU = 0x0F; //for Rx pull Does anyone have a CH559 serial port (UART0) that receives normally? Please upload a .hex to see if there is a problem with my board.

WeChat Image_20180430215440.jpg (112.2 KB, downloads: 0)

WeChat Image_20180430215440.jpg

WeChat Image_20180430215440.jpg (63.24 KB, downloads: 0)

WeChat Image_20180430215440.jpg
This post is from MCU

Latest reply

For CH340 problems, you can call: 025-52638360  Details Published on 2018-5-10 14:12

18

Posts

0

Resources
2
After struggling for a while, I still don't know how to delete one of the duplicate pictures. . .
This post is from MCU

63

Posts

0

Resources
3
Serial port 0 receives in the example DEBUG.C, and sends.
This post is from MCU

4002

Posts

0

Resources
4
What microcontroller?
This post is from MCU

Comments

USB MCU CH559  Details Published on 2018-5-9 16:29

305

Posts

0

Resources
5
huo_hu posted on 2018-5-9 10:06 What microcontroller is it?
USB microcontroller CH559
This post is from MCU

Comments

Oh, never used  Details Published on 2018-5-9 17:14
Personal signature单价1元含税的USB和Touchkey单片机CH551G已大批量出货,试样QQ:1258305301

4002

Posts

0

Resources
6
Oh, I haven't used it.
This post is from MCU

59

Posts

0

Resources
7
We also planned to use this chip at first, but because the software engineer couldn't figure it out, we changed it to HC9326 plus 52
This post is from MCU
Personal signature打开窗户看外面

18

Posts

0

Resources
8
I found the problem. It turned out to be a problem with the USB to UART module. But this problem is very strange: it can send and receive data by itself, but sometimes it fails to receive data when sent to other modules. Verification: I found two more USB to UART modules. The original module with the problem is COM4 (CH340). The 559 board cannot receive the data it sends. The other two are COM9 (CH340) and COM10 (PL2303). 1. All three modules send and receive data by themselves, which is normal. It also shows that the Dupont line is normal. 2. COM4 and COM9 cross-transmit and receive. 4 can receive data sent by 9, but 9 cannot receive data sent by 4. 3. COM10 and COM9 cross-transmit and receive. It is normal. 4. COM10 and COM4 cross-transmit and receive. It is normal. 5. COM10, COM9 and CH559 board send and receive data normally. Who can explain why COM4 can receive data, but it is selective when sending to other modules? (Excluding wiring errors), especially when using LA at the other party's Rx, you can see that the data has come.
This post is from MCU

Comments

For questions about CH340, please call: 025-52638360  Details Published on 2018-5-10 14:12

305

Posts

0

Resources
9
mig29ee posted on 2018-5-10 09:32 I found the problem. It turned out to be a problem with the USB to UART module. But this problem is very strange: it can send and receive data by itself, but sometimes it fails to send to other modules.
For CH340 problems, you can call: 025-52638360
This post is from MCU
Personal signature单价1元含税的USB和Touchkey单片机CH551G已大批量出货,试样QQ:1258305301

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

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