thx@Karol, the conditions are described as below. 1.motor_return_status is declared like that, static uint8_t motor_return_status; 2. the return value from read call is SSP_SUCCESS. 3.The most strange point is that even though I didn't turn on the slave device, the following sentences for DK S7-G2 as master could run through out smoothly and not wait for the return value from slave device at all. And received value is always same with the sent value though I've turned off the loopback funtion. /**************************************************************************************************************************************************************/ #include "uart_thread.h" static uint8_t motor_control_cmd; static uint8_t motor_return_status; void uart_thread_entry(void); void uart_thread_entry(void) { g_ioport.p_api- pinWrite(IOPORT_PORT_09_PIN_15, IOPORT_LEVEL_HIGH); //turn off loopback function g_ioport.p_api- pinWrite(IOPORT_PORT_09_PIN_14, IOPORT_LEVEL_HIGH); //enable 485 write motor_control_cmd = 0x46; err = g_sf_comms1.p_api- write(g_sf_comms1.p_ctrl,(uint8_t * const)&motor_control_cmd,1,1); if (SSP_SUCCESS != err) { while(1); } g_ioport.p_api- pinWrite(IOPORT_PORT_09_PIN_14, IOPORT_LEVEL_LOW); //enable 485 read err = g_sf_comms1.p_api- read(g_sf_comms1.p_ctrl,(uint8_t * const)&motor_return_status,1,TX_WAIT_FOREVER); if (SSP_SUCCESS != err) { while(1); } motor_return_status = 0; .... /**************************************************************************************************************************************************************/ 4. and S102 switch setting is OK. Best Regards, feng
↧