USB Host Shield 2.0 - How to enable DTR and RTS ?
hi,
i try receive data usb ftdi device (which push data every 10 secondes) display data in arduino monitor.
the problem (i think) have enable dtr , rts usb host shield 2.0, don't know how it.
usb configuration need:
baudrate: 115200
flow control: xon
dtr , rts on
capture local echo
can me please ?
i'm using arduino uno + usb host shield 2.0.
my code:
thank in advance.
i try receive data usb ftdi device (which push data every 10 secondes) display data in arduino monitor.
the problem (i think) have enable dtr , rts usb host shield 2.0, don't know how it.
usb configuration need:
baudrate: 115200
flow control: xon
dtr , rts on
capture local echo
can me please ?
i'm using arduino uno + usb host shield 2.0.
my code:
code: [select]
#include <sd.h>
#include <adk.h>
#include <cdcftdi.h>
//#include <usbhub.h>
#include "pgmstrings.h"
class ftdiasync : public ftdiasyncoper
{
public:
virtual uint8_t oninit(ftdi *pftdi);
};
uint8_t ftdiasync::oninit(ftdi *pftdi)
{
uint8_t rcode = 0;
rcode = pftdi->setbaudrate(115200);
if (rcode)
{
errormessage<uint8_t>(pstr("setbaudrate"), rcode);
return rcode;
}
rcode = pftdi->setflowcontrol(ftdi_sio_disable_flow_ctrl, ftdi_sio_xon_xoff_hs);
if (rcode)
errormessage<uint8_t>(pstr("setflowcontrol"), rcode);
return rcode;
}
int led = 13;
usb usb;
//usbhub hub1(&usb);
ftdiasync ftdiasync;
ftdi ftdi(&usb, &ftdiasync);
uint32_t next_time;
// setup routine runs once when press reset:
void setup() {
// initialize digital pin output.
pinmode(led, output);
// open serial communications , wait port open:
serial.begin(115200);
//for usb
if (usb.init() == -1) {
serial.println("ko: osc did not start.");
}
else {
serial.println("ok: osc start.");
}
delay( 2000 );
next_time = millis() + 5000;
//end usb
}
// loop routine runs on , on again forever:
void loop() {
usb.task();
if( usb.getusbtaskstate() == usb_state_running )
{
digitalwrite(led, high);
uint8_t rcode;
uint8_t buf[64];
(uint8_t i=0; i<64; i++)
buf[i] = 0;
uint16_t rcvd = 64;
rcode = ftdi.rcvdata(&rcvd, buf);
serial.println(rcvd);
if (rcode && rcode != hrnak)
errormessage<uint8_t>(pstr("ret"), rcode);
// device reserves first 2 bytes of data
// to contain current values of modem , line status registers.
if (rcvd > 2)
serial.print((char*)(buf+2));
delay(10);
digitalwrite(led, low);
}
}
thank in advance.
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > USB Host Shield 2.0 - How to enable DTR and RTS ?
arduino
Comments
Post a Comment