Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPGA UART test cases addition with 7 and 9 bits data length #12615

Merged
merged 6 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion TESTS/configs/fpga.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"K64F": {
"target.macros_add": [
"UART_7BITS_PARITY_NONE_NOT_SUPPORTED"
"UART_7BITS_NOT_SUPPORTED",
"UART_9BITS_NOT_SUPPORTED"
]
},
"STM": {
Expand Down
51 changes: 51 additions & 0 deletions TESTS/mbed_hal_fpga_ci_test_shield/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Testing with FPGA CI TEST shield

## Setup

![30% center](fpga_test_shield.jpg)

```
mbed test -n tests*fpga* --app-config tests/configs/fpga.json
```

FPGA_CI_TEST_SHIELD needed macro
and specific test capabilities per target
are defined in:
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/configs/fpga.json



## MBED-OS

Tested from factor is defined by MBED_CONF_TARGET_DEFAULT_FORM_FACTOR
"default-form-factor" default value is null.

When "default-form-factor" is not set, ARDUINO form factor is used.

Default ff_arduino_pins is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L28-L32

Default ff_arduino_names is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L34-L38

Default empty_gpio_pinmap is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_gpio.c#L89-L114

Some pins are restricted:
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L69-L73

Some peripherals are restricted:
https://github.com/ARMmbed/mbed-os/blob/master/hal/mbed_pinmap_default.cpp#L94-L100


## Known issues


## LINKS

https://github.com/ARMmbed/fpga-ci-test-shield

https://github.com/ARMmbed/fpga-ci-test-shield-updater

https://github.com/ARMmbed/fpga-ci-test-shield-terminal

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 44 additions & 6 deletions TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,37 @@ static void test_irq_handler(uint32_t id, SerialIrq event)
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)
{
// The FPGA CI shield only supports None, Odd & Even.
// Forced parity is not supported on Atmel, Freescale, Nordic & STM targets.
// Forced parity is not supported on many targets
MBED_ASSERT(parity != ParityForced1 && parity != ParityForced0);

// STM-specific constraints
// Only 7, 8 & 9 data bits.
MBED_ASSERT(data_bits >= 7 && data_bits <= 9);
// Only Odd or Even parity for 7 data bits.
// See TESTS/configs/fpga.json to check which target supports what
#if defined(UART_9BITS_NOT_SUPPORTED)
if (data_bits == 9) {
utest_printf(" UART_9BITS_NOT_SUPPORTED set ... ");
return;
}
#endif

#if defined(UART_9BITS_PARITY_NOT_SUPPORTED)
if ((data_bits == 9) && (parity != ParityNone)) {
utest_printf(" UART_9BITS_PARITY_NOT_SUPPORTED set ... ");
return;
}
#endif

#if defined(UART_7BITS_NOT_SUPPORTED)
if (data_bits == 7) {
MBED_ASSERT(parity != ParityNone);
utest_printf(" UART_7BITS_NOT_SUPPORTED set ... ");
return;
}
#endif

#if defined(UART_7BITS_PARITY_NONE_NOT_SUPPORTED)
if ((data_bits == 7) && (parity == ParityNone)) {
utest_printf(" UART_7BITS_PARITY_NONE_NOT_SUPPORTED set ... ");
return;
}
#endif

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

// same test with 7 and 9 bits data length
Case("basic, 9600, 7N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 7, ParityNone, 1, false> >),
Case("basic, 9600, 9N1, FC off", all_peripherals<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<9600, 9, ParityNone, 1, false> >),

// One set of pins from one peripheral.
// baudrate
Case("19200, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<19200, 8, ParityNone, 1, false> >),
Expand All @@ -351,6 +376,10 @@ Case cases[] = {
Case("basic, 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, false> >),
Case("basic (direct init), 9600, 8N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 1, true> >),

// same test with 7 and 9 bits data length
Case("basic, 9600, 7N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityNone, 1, false> >),
Case("basic, 9600, 9N1, FC on", all_peripherals<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityNone, 1, false> >),

// One set of pins from one peripheral.
// baudrate
Case("19200, 8N1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<19200, 8, ParityNone, 1, false> >),
Expand All @@ -360,8 +389,17 @@ Case cases[] = {
// parity
#if !defined(UART_ODD_PARITY_NOT_SUPPORTED)
Case("9600, 8O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityOdd, 1, false> >),

// same test with 7 and 9 bits data length
Case("9600, 7O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityOdd, 1, false> >),
Case("9600, 9O1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityOdd, 1, false> >),
#endif
Case("9600, 8E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityEven, 1, false> >),

// same test with 7 and 9 bits data length
Case("9600, 7E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 7, ParityEven, 1, false> >),
Case("9600, 9E1, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 9, ParityEven, 1, false> >),

// stop bits
#if !defined(UART_TWO_STOP_BITS_NOT_SUPPORTED)
Case("9600, 8N2, FC on", one_peripheral<UARTPort, DefaultFormFactor, fpga_uart_test_common<9600, 8, ParityNone, 2, false> >),
Expand Down
4 changes: 1 addition & 3 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5604,9 +5604,7 @@
"WSF_MAX_HANDLERS=10",
"MBED_MPU_CUSTOM",
"SWI_DISABLE0",
"NRF52_PAN_20",
"UART_TWO_STOP_BITS_NOT_SUPPORTED",
"UART_ODD_PARITY_NOT_SUPPORTED"
"NRF52_PAN_20"
],
"features": [
"CRYPTOCELL310",
Expand Down