kingforger
Active member
I made a quick VC++ command line program to communicate with the teensy 3.0. I can send basic commands back and forth at 256000 baud. Yay.
Question: How do I take advantage of the 12Mbps communication of the teensy? I'm using serial in my VC++ program, and I can only go up to 256000 baud with my current library that I'm using. Is there a similarly (like serial) easy way to transfer data quickly or set a 12000000 baud?
Basically, I have a 4GB SD card attached to the teensy. I want to be able to dump all the data from the card to the PC going through the teensy. But doing it at 256000 baud is just too slow...
Oh, and my code to establish a serial connection is just like this...not that I think it is relevant...ignore the crazy long timeouts:
void EstablishSerialConnection()
{
hSerial = CreateFile(_T("COM7"),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hSerial==INVALID_HANDLE_VALUE){
if(GetLastError()==ERROR_FILE_NOT_FOUND){
cout<<"Com port 1 does not appear to exist!"<<endl;
}
cout<<"invalid serial port handle thingy..."<<endl;
}
DCB dcbSerialParams = {0};
dcbSerialParams.DCBlength=sizeof(dcbSerialParams);
if (!GetCommState(hSerial, &dcbSerialParams)) {
cout<<"Error getting serial port comm state"<<endl;
}
dcbSerialParams.BaudRate=CBR_256000;
dcbSerialParams.ByteSize=8;
dcbSerialParams.StopBits=ONESTOPBIT;
dcbSerialParams.Parity=NOPARITY;
if(!SetCommState(hSerial, &dcbSerialParams)){
cout<<"Error setting serial port parameters"<<endl;
}
COMMTIMEOUTS timeouts={0};
timeouts.ReadIntervalTimeout=500;
timeouts.ReadTotalTimeoutConstant=500;
timeouts.ReadTotalTimeoutMultiplier=100;
timeouts.WriteTotalTimeoutConstant=500;
timeouts.WriteTotalTimeoutMultiplier=100;
if(!SetCommTimeouts(hSerial, &timeouts)){
cout<<"Error setting serial port timeouts"<<endl;
}
}
Question: How do I take advantage of the 12Mbps communication of the teensy? I'm using serial in my VC++ program, and I can only go up to 256000 baud with my current library that I'm using. Is there a similarly (like serial) easy way to transfer data quickly or set a 12000000 baud?
Basically, I have a 4GB SD card attached to the teensy. I want to be able to dump all the data from the card to the PC going through the teensy. But doing it at 256000 baud is just too slow...
Oh, and my code to establish a serial connection is just like this...not that I think it is relevant...ignore the crazy long timeouts:
void EstablishSerialConnection()
{
hSerial = CreateFile(_T("COM7"),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hSerial==INVALID_HANDLE_VALUE){
if(GetLastError()==ERROR_FILE_NOT_FOUND){
cout<<"Com port 1 does not appear to exist!"<<endl;
}
cout<<"invalid serial port handle thingy..."<<endl;
}
DCB dcbSerialParams = {0};
dcbSerialParams.DCBlength=sizeof(dcbSerialParams);
if (!GetCommState(hSerial, &dcbSerialParams)) {
cout<<"Error getting serial port comm state"<<endl;
}
dcbSerialParams.BaudRate=CBR_256000;
dcbSerialParams.ByteSize=8;
dcbSerialParams.StopBits=ONESTOPBIT;
dcbSerialParams.Parity=NOPARITY;
if(!SetCommState(hSerial, &dcbSerialParams)){
cout<<"Error setting serial port parameters"<<endl;
}
COMMTIMEOUTS timeouts={0};
timeouts.ReadIntervalTimeout=500;
timeouts.ReadTotalTimeoutConstant=500;
timeouts.ReadTotalTimeoutMultiplier=100;
timeouts.WriteTotalTimeoutConstant=500;
timeouts.WriteTotalTimeoutMultiplier=100;
if(!SetCommTimeouts(hSerial, &timeouts)){
cout<<"Error setting serial port timeouts"<<endl;
}
}
Last edited: