![]() | LEGO Mindstorms EV3 |
Manages the sequence necessary when adding a UART devices to an input port.
The UART Device Controller gets information from the DCM driver Device Detection Manager Driver about the port state and when the DCM driver detects a UART device on the port the sequence below the following defines is started inside the UART Device Controller.
*/ #define LOWEST_BITRATE 2400 // Lowest possible bit rate (always used for sync and info) [b/S] #define MIDLE_BITRATE 57600 // Highest bit rate allowed when adjusting clock [b/S] #define HIGHEST_BITRATE 460800 // Highest possible bit rate [b/S] /* SEQUENCE WHEN UART DEVICE IS DETECTED ===================================== HOST DEVICE ------------------------------------------------------------ ---------------------------------------------------------------------- - Reset <----------------------------, - Set TX active (low) | - Set RX floating | - Wait half a second 1st.time (next time >=10mS) | | - Enable UART communication - Enable UART communication | - Setup UART for LOWEST_BITRATE - Setup UART for LOWEST_BITRATE | - Setup hardware buffers | | | - Exchange informations - Exchange informations | - Receive command data <-- CMD - Send command data (type,modes,speed, etc) | - Send command data (type,modes,speed, etc) CMD --> - Receive command data | - Receive info data <-- INFO - Send info data (name,scaling,data format, etc) | - Send info data (name,scaling,data format, etc) INFO --> - Receive info data | - Receive acknowledge <-- ACK - When finished info send acknowledge | - Timeout (80mS) -----------------------------' - When finished info send acknowledge ACK --> - Receive acknowledge - Switch to valid communication speed - Switch to valid communication speed - Communication running - Communication running - Receive data <-- DATA - Send data - Every 100mS, send watchdog service NACK --> - If more than one of six messages is correct send NACK - Receive data <-- DATA - Send data - Receive data <-- DATA - Send data - Receive data <-- DATA - Send data -- - Send command CMD --> - Receive command - Receive data <-- DATA - Send data - Receive data <-- DATA - Send data -- - Receive data <-- DATA - Send data - Every 100mS, send watchdog service NACK --> - If more than one of six messages is correct send NACK - Receive data <-- DATA - Send data - Receive data <-- DATA - Send data - Receive data <-- DATA - Send data -- DEVICES ======= Devices should only send data when data changes at a maximum rate of 1mS and if the time elapsed since last change exceeds 100mS. Data should also be send after a watchdog service message has been received. If watchdog service (NACK) is not received within 1000 mS the device should reset. When placed wrong on an output port device TX should continue to transmit SYNC, INFO or DATA to ensure that the host detects that connection 6 is low
HOST ==== The host sends a watchdog service message (NACK) every 100 mS if no error occours. The host should check every data message format against the info once sent from the device and leave out the watchdog service when the data is not valid within 6 messages.
\n