//************ Add to prj.conf file ****** CONFIG_SERIAL=y CONFIG_UART_ASYNC_API=y CONFIG_RESET_ON_FATAL_ERROR=n CONFIG_LOG=y CONFIG_THREAD_NAME=y //***************add to the overlay file &uart0{ current-speed = <115200>; }; &uart1{ current-speed = <9600>; status = "okay"; }; &i2c0{ status = "okay"; clock-frequency = < 400 >; }; //*************************************** static const struct device *wifi_uart; static const struct device *bms_uart; //************************************* void init_i2c_master() { dev_i2c = device_get_binding("I2C_0"); if (dev_i2c == NULL) { printk("Failed to get I2C0 binding\n"); return; } } void wifi_uart_init(void) { wifi_uart = device_get_binding("UART_0"); if (wifi_uart == NULL) { printk("Failed to get UART0 binding\n"); return; } } void bms_uart_init(void) { bms_uart = device_get_binding("UART_1"); if (bms_uart == NULL) { printk("Failed to get UART1 binding\n"); return; } } void disable_uart1(){ NRF_UARTE0->TASKS_STOPTX = 1; NRF_UARTE0->TASKS_STOPRX = 1; } void enable_uart1(){ NRF_UARTE0->TASKS_STARTRX = 1; NRF_UARTE3->TASKS_STARTRX = 1; } void main() { wifi_uart_init(); bms_uart_init(); disable_uart1();// disable UART1 to enable I2C0 init_i2c_master();// I2C0 enable }