Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 0134160

Browse files
authored
Use 38400 baud instead of 57600 baud in examples/printf.
Co-authored-by: bifferos <bifferos@users.noreply.github.com>
1 parent 03321ba commit 0134160

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

examples/printf/main.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,27 @@
22
#include <fx2debug.h>
33
#include <stdio.h>
44

5-
DEFINE_DEBUG_PUTCHAR_FN(PA0, 57600)
65

7-
int main(void) {
8-
// Any of these will work at 57600 baud:
9-
CPUCS = 0;
10-
// CPUCS = _CLKSPD0;
11-
// CPUCS = _CLKSPD1;
6+
// An example of how to push characters to a software UART on PA0.
7+
// As a test, the CLK speed is changed to check the code works for
8+
// a variety of frequencies.
9+
// 38400 likely works in all scenarios, YMMV with higher values.
10+
1211

12+
DEFINE_DEBUG_PUTCHAR_FN(PA0, 38400)
13+
14+
int main(void) {
1315
OEA = (1U<<0);
1416
PA0 = 1;
1517

16-
printf("Hello, world!\n");
18+
CPUCS = 0;
19+
printf("Hello, world at 12MHz CPU clock!\r\n");
20+
21+
CPUCS = _CLKSPD0;
22+
printf("Hello, world at 24MHz CPU clock!\r\n");
23+
24+
CPUCS = _CLKSPD1;
25+
printf("Hello, world at 48MHz CPU clock!\r\n");
26+
1727
while(1);
1828
}

0 commit comments

Comments
 (0)