EmbDev.net

Forum: µC & Digital Electronics ch55xduino - CH552 serial print to txd port


von Henrik A. (henrikandersen)


Rate this post
useful
not useful
Hi,

Im working on a CH552 project using ch55xduino IDE with a Development 
Board: “CH552 Core Board by WeActStudio”

I trying to write a simple text “Hello,World" to an cpu port (31) TXD.

But can not get the code working, can any give me hand with the code

Has anybody used Serial0.println or Serial1.println

USBSerial_print(“Hello,World”); works perfect !

Code:

void setup() { Serial1.begin(9600); while (!Serial1); }

void loop() { Serial1.println("Hello,World"); delay(1000); }

von Thomas Z. (usbman)


Rate this post
useful
not useful
ch55xduino uses SDCC for compiling. Therefore no c++ syntax is allowed.

try using the underscore instead of the dot.
e.g.
Serial1_println("Hello World");

and for output at P3.1 Serial0_println();

von Henrik A. (henrikandersen)


Rate this post
useful
not useful
Hello Thomas,

Thanks for your suggestions, unfortunately I'm still not getting any 
data out on ant of the ports.

I have tried to connect my serial capture program ( RealTerm ) to any 
port without result.

When I connect Rx to TX my serial capture program, the capture program 
echo what I type, so I'm sure the capture program works fine.

I also have no compile error, so looks like CHxxDuino accept:
- Serial0_println("Hello World");
- Serial1_println("Hello World");

USBSerial_println("Hello World"); works fine ! using Arduino Serial 
Monitor.

Any other suggestions ?

void setup() {
}

void loop() {
Serial0_println("Hello World");   // print to P1.7
Serial1_println("Hello World");   // print to P3.1
USBSerial_println("Hello World"); // print to USB ( Works fine )
delay(100);
}

von Thomas Z. (usbman)


Rate this post
useful
not useful
I dont use Arduino code on that board, so my knowledge is very limited.

But here is the thing:
Output on TX0 or TX1 usually requires to TI =1 (U1TI = 1) in Non 
Interrupt mode to signal the transmiter is empty. I suppose this is done 
in Serial0_begin() and Serial1_begin().


void setup() {
  Serial0_begin(9600);
  Serial1_begin(9600);
}

void loop() {
Serial0_println("Hello World0");   // print to P1.7
Serial1_println("Hello World1");   // print to P3.1
USBSerial_println("Hello World");  // print to USB ( Works fine )
delay(100);
}

: Edited by User
von Pierre B. (pierreaps)


Rate this post
useful
not useful
I appreciate your advice, but regrettably I'm still not able to pull any 
data out of any of the ports.

von Klaus S. (kseege)


Rate this post
useful
not useful
Pierre B. wrote:
> I appreciate your advice, but regrettably I'm still not able to pull any
> data out of any of the ports.

Could You already successfully run any of the examples?
Maybe Your problem is located in a lower level.

Best regards
Klaus

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.