@@ -450,7 +450,9 @@ void periman_test(void) {
450450
451451 for (auto *ref : uart_test_configs) {
452452 UARTTestConfig &config = *ref;
453- Wire.begin (config.default_rx_pin , config.default_tx_pin );
453+ // when both RX and TX are detached the UART driver is stopped,
454+ // therefore, it may change just one the UART pins for testing
455+ Wire.begin (config.default_rx_pin , -1 );
454456 config.recv_msg = " " ;
455457
456458 log_d (" Trying to send message using UART%d with I2C enabled" , config.uart_num );
@@ -459,7 +461,30 @@ void periman_test(void) {
459461
460462 log_d (" Disabling I2C and re-enabling UART%d" , config.uart_num );
461463
464+ // when just chenging one UART pin, the driver will continue to work
465+ // and it is possible to just change back the UART pins
462466 config.serial .setPins (config.default_rx_pin , config.default_tx_pin );
467+
468+ uart_internal_loopback (config.uart_num , config.default_rx_pin );
469+
470+ log_d (" Trying to send message using UART%d with I2C disabled" , config.uart_num );
471+ config.transmit_and_check_msg (" while I2C is disabled" );
472+
473+
474+ // when both RX and TX are detached the UART driver is stopped,
475+ // Therefore, it needs to be restarted
476+ Wire.begin (config.default_rx_pin , config.default_tx_pin );
477+ config.recv_msg = " " ;
478+
479+ log_d (" Trying to send message using UART%d with I2C enabled" , config.uart_num );
480+ config.transmit_and_check_msg (" while used by I2C" , false );
481+ TEST_ASSERT_EQUAL_STRING (" " , config.recv_msg .c_str ());
482+
483+ log_d (" Disabling I2C and re-enabling UART%d" , config.uart_num );
484+
485+ // when both RX and TX are detached the UART driver is stopped, therefore, starting the driver again is necessary
486+ config.serial .begin (115200 , SERIAL_8N1, config.default_rx_pin , config.default_tx_pin );
487+
463488 uart_internal_loopback (config.uart_num , config.default_rx_pin );
464489
465490 log_d (" Trying to send message using UART%d with I2C disabled" , config.uart_num );
@@ -468,7 +493,6 @@ void periman_test(void) {
468493
469494 Serial.println (" Peripheral manager test successful" );
470495}
471-
472496// This test checks if messages can be transmitted and received correctly after changing the CPU frequency
473497void change_cpu_frequency_test (void ) {
474498 uint32_t old_freq = getCpuFrequencyMhz ();
0 commit comments