From cf2cdd324e0f9df0aa4ff4850558bdfdf962d5b7 Mon Sep 17 00:00:00 2001 From: Peter Jansen Date: Tue, 29 Jun 2010 12:17:57 +1200 Subject: [PATCH] Set Olimex baud rate on startup. --- olimex.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/olimex.c b/olimex.c index 70824db..5a40ce8 100644 --- a/olimex.c +++ b/olimex.c @@ -57,6 +57,7 @@ struct olimex_transport { #define CP210x_REQTYPE_HOST_TO_DEVICE 0x41 #define CP210X_IFC_ENABLE 0x00 +#define CP210X_SET_BAUDDIV 0x01 #define CP210X_SET_MHS 0x07 #define TIMEOUT 1000 @@ -104,6 +105,16 @@ static int open_interface(struct olimex_transport *tr, printf(__FILE__": %s : Sending control message ret %d\n", __FUNCTION__, ret); #endif + /* Set the baud rate to 500000 bps */ + ret = usb_control_msg(tr->handle, CP210x_REQTYPE_HOST_TO_DEVICE, + CP210X_SET_BAUDDIV, 0x7, 0, NULL, 0, 300); +#ifdef DEBUG_OLIMEX + printf(__FILE__": %s : Sending control message ret %d\n", + __FUNCTION__, ret); +#endif + /* Set the modem control settings. + * Set RTS, DTR and WRITE_DTR, WRITE_RTS + */ ret = usb_control_msg(tr->handle, CP210x_REQTYPE_HOST_TO_DEVICE, CP210X_SET_MHS, 0x303, 0, NULL, 0, 300); #ifdef DEBUG_OLIMEX