Skip to content

Commit

Permalink
[test] Enable high baud rates on silicon
Browse files Browse the repository at this point in the history
Signed-off-by: James Wainwright <[email protected]>
(cherry picked from commit 1c6a9a5)
  • Loading branch information
jwnrt committed Nov 18, 2024
1 parent 0245f5b commit f090a0a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions sw/device/tests/uart_baud_rate_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ static const uint32_t kBaseAddrs[4] = {
TOP_EARLGREY_UART2_BASE_ADDR,
TOP_EARLGREY_UART3_BASE_ADDR,
};
static uint32_t kBauds[7] = {
9600, 115200, 230400, 128000, 256000, 1000000, 1500000,
};
static const uint32_t kBauds[11] = {
4800, 9600, 19200, 38400, 57600, 115200, 230400, 128000, 256000,
// These baud rates will only work on silicon, the FPGA cannot go fast enough:
1000000, 1500000};

enum {
kTestTimeoutMillis = 500000,
// Number of Bauds to test from `kBauds`.
kBaudCountSilicon = 7,
// The two highest Bauds won't work at the clock speed we run the FPGAs at.
kBaudCountFpga = 5,
};

typedef enum test_phase {
Expand Down Expand Up @@ -112,8 +109,13 @@ bool test_main(void) {
CHECK_STATUS_OK(
uart_testutils_select_pinmux(&pinmux, uart_idx, kUartPinmuxChannelDut));

size_t baud_count =
kDeviceType == kDeviceSilicon ? kBaudCountSilicon : kBaudCountFpga;
size_t baud_count = ARRAYSIZE(kBauds);

// We only want to run the highest bauds (1MBd and 1.5MBd) on chips going
// at the real speed (24MHz). FPGAs clocking slower cannot test these.
if (kClockFreqPeripheralHz < 24 * 1000 * 1000) {
baud_count -= 2;
}

// Check every baud rate is sent and received okay.
status_t result = OK_STATUS();
Expand Down

0 comments on commit f090a0a

Please sign in to comment.