Skip to content

Commit 698fc09

Browse files
authored
Merge pull request #12615 from jeromecoutant/PR_FPGA_UART
FPGA UART test cases addition with 7 and 9 bits data length
2 parents f858000 + 1a64d6e commit 698fc09

File tree

5 files changed

+98
-10
lines changed

5 files changed

+98
-10
lines changed

TESTS/configs/fpga.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
},
1414
"K64F": {
1515
"target.macros_add": [
16-
"UART_7BITS_PARITY_NONE_NOT_SUPPORTED"
16+
"UART_7BITS_NOT_SUPPORTED",
17+
"UART_9BITS_NOT_SUPPORTED"
1718
]
1819
},
1920
"STM": {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Testing with FPGA CI TEST shield
2+
3+
## Setup
4+
5+
![30% center](fpga_test_shield.jpg)
6+
7+
```
8+
mbed test -n tests*fpga* --app-config tests/configs/fpga.json
9+
```
10+
11+
FPGA_CI_TEST_SHIELD needed macro
12+
and specific test capabilities per target
13+
are defined in:
14+
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/configs/fpga.json
15+
16+
17+
18+
## MBED-OS
19+
20+
Tested from factor is defined by MBED_CONF_TARGET_DEFAULT_FORM_FACTOR
21+
"default-form-factor" default value is null.
22+
23+
When "default-form-factor" is not set, ARDUINO form factor is used.
24+
25+
Default ff_arduino_pins is defined in:
26+
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L28-L32
27+
28+
Default ff_arduino_names is defined in:
29+
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L34-L38
30+
31+
Default empty_gpio_pinmap is defined in:
32+
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_gpio.c#L89-L114
33+
34+
Some pins are restricted:
35+
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L69-L73
36+
37+
Some peripherals are restricted:
38+
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L94-L100
39+
40+
41+
## Known issues
42+
43+
44+
## LINKS
45+
46+
https://github.com/ARMmbed/fpga-ci-test-shield
47+
48+
https://github.com/ARMmbed/fpga-ci-test-shield-updater
49+
50+
https://github.com/ARMmbed/fpga-ci-test-shield-terminal
51+
Loading

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,37 @@ static void test_irq_handler(uint32_t id, SerialIrq event)
8686
static void uart_test_common(int baudrate, int data_bits, SerialParity parity, int stop_bits, bool init_direct, PinName tx, PinName rx, PinName cts, PinName rts)
8787
{
8888
// The FPGA CI shield only supports None, Odd & Even.
89-
// Forced parity is not supported on Atmel, Freescale, Nordic & STM targets.
89+
// Forced parity is not supported on many targets
9090
MBED_ASSERT(parity != ParityForced1 && parity != ParityForced0);
9191

92-
// STM-specific constraints
93-
// Only 7, 8 & 9 data bits.
94-
MBED_ASSERT(data_bits >= 7 && data_bits <= 9);
95-
// Only Odd or Even parity for 7 data bits.
92+
// See TESTS/configs/fpga.json to check which target supports what
93+
#if defined(UART_9BITS_NOT_SUPPORTED)
94+
if (data_bits == 9) {
95+
utest_printf(" UART_9BITS_NOT_SUPPORTED set ... ");
96+
return;
97+
}
98+
#endif
99+
100+
#if defined(UART_9BITS_PARITY_NOT_SUPPORTED)
101+
if ((data_bits == 9) && (parity != ParityNone)) {
102+
utest_printf(" UART_9BITS_PARITY_NOT_SUPPORTED set ... ");
103+
return;
104+
}
105+
#endif
106+
107+
#if defined(UART_7BITS_NOT_SUPPORTED)
96108
if (data_bits == 7) {
97-
MBED_ASSERT(parity != ParityNone);
109+
utest_printf(" UART_7BITS_NOT_SUPPORTED set ... ");
110+
return;
98111
}
112+
#endif
113+
114+
#if defined(UART_7BITS_PARITY_NONE_NOT_SUPPORTED)
115+
if ((data_bits == 7) && (parity == ParityNone)) {
116+
utest_printf(" UART_7BITS_PARITY_NONE_NOT_SUPPORTED set ... ");
117+
return;
118+
}
119+
#endif
99120

100121
// Limit the actual TX & RX chars to 8 bits for this test.
101122
int test_buff_bits = data_bits < 8 ? data_bits : 8;
@@ -333,6 +354,10 @@ Case cases[] = {
333354
Case("basic, 9600, 8N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 8, ParityNone, 1, false> >),
334355
Case("basic (direct init), 9600, 8N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 8, ParityNone, 1, true> >),
335356

357+
// same test with 7 and 9 bits data length
358+
Case("basic, 9600, 7N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 7, ParityNone, 1, false> >),
359+
Case("basic, 9600, 9N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 9, ParityNone, 1, false> >),
360+
336361
// One set of pins from one peripheral.
337362
// baudrate
338363
Case("19200, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<19200, 8, ParityNone, 1, false> >),
@@ -351,6 +376,10 @@ Case cases[] = {
351376
Case("basic, 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, false> >),
352377
Case("basic (direct init), 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, true> >),
353378

379+
// same test with 7 and 9 bits data length
380+
Case("basic, 9600, 7N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityNone, 1, false> >),
381+
Case("basic, 9600, 9N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityNone, 1, false> >),
382+
354383
// One set of pins from one peripheral.
355384
// baudrate
356385
Case("19200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<19200, 8, ParityNone, 1, false> >),
@@ -360,8 +389,17 @@ Case cases[] = {
360389
// parity
361390
#if !defined(UART_ODD_PARITY_NOT_SUPPORTED)
362391
Case("9600, 8O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityOdd, 1, false> >),
392+
393+
// same test with 7 and 9 bits data length
394+
Case("9600, 7O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityOdd, 1, false> >),
395+
Case("9600, 9O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityOdd, 1, false> >),
363396
#endif
364397
Case("9600, 8E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityEven, 1, false> >),
398+
399+
// same test with 7 and 9 bits data length
400+
Case("9600, 7E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityEven, 1, false> >),
401+
Case("9600, 9E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityEven, 1, false> >),
402+
365403
// stop bits
366404
#if !defined(UART_TWO_STOP_BITS_NOT_SUPPORTED)
367405
Case("9600, 8N2, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 2, false> >),

targets/targets.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5640,9 +5640,7 @@
56405640
"WSF_MAX_HANDLERS=10",
56415641
"MBED_MPU_CUSTOM",
56425642
"SWI_DISABLE0",
5643-
"NRF52_PAN_20",
5644-
"UART_TWO_STOP_BITS_NOT_SUPPORTED",
5645-
"UART_ODD_PARITY_NOT_SUPPORTED"
5643+
"NRF52_PAN_20"
56465644
],
56475645
"features": [
56485646
"CRYPTOCELL310",

0 commit comments

Comments
 (0)