1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-07 16:06:10 +00:00

Correct USART init for stm32 autobauding

Hello,

I had some headache trying to figure out the issue when flashing some stm32 mcu over uart [1] 

With the above changes i can now flash stm32 devices correctly.

regards,

1 : http://www.st.com/web/en/resource/technical/document/application_note/CD00264342.pdf
This commit is contained in:
Trey Marc 2014-10-27 21:26:37 +01:00
parent 09c84a4a3c
commit 8f439384a7

View File

@ -267,29 +267,25 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
configDataBits |= 0x0800;
break;
}
setConfigSingle(SILABSER_SET_LINE_CTL_REQUEST_CODE, configDataBits);
int configParityBits = 0; // PARITY_NONE
switch (parity) {
case PARITY_ODD:
configParityBits |= 0x0010;
configDataBits |= 0x0010;
break;
case PARITY_EVEN:
configParityBits |= 0x0020;
configDataBits |= 0x0020;
break;
}
setConfigSingle(SILABSER_SET_LINE_CTL_REQUEST_CODE, configParityBits);
int configStopBits = 0;
switch (stopBits) {
case STOPBITS_1:
configStopBits |= 0;
configDataBits |= 0;
break;
case STOPBITS_2:
configStopBits |= 2;
configDataBits |= 2;
break;
}
setConfigSingle(SILABSER_SET_LINE_CTL_REQUEST_CODE, configStopBits);
setConfigSingle(SILABSER_SET_LINE_CTL_REQUEST_CODE, configDataBits);
}
@Override