Reply
Posts: 2
Registered: ‎10-01-2017

SetCommBreak/ClearCommBreak problem with CP2102

Hi, I'm trying to implement bit-banged serial interface (TX, RTS, DTR) using a CP2102 chip and I'm experiencing a problem related to setting/clearing the break on the TX line using either SetCommBreak/ClearCommBreak or EscapeCommFunction(hCom, SETBREAK)/EscapeCommFunction(hCom, CLRBREAK) function. The error I get is always: ERROR_GEN_FAILURE, 31 (0x1F), A device attached to the system is not functioning. Other signals (i.e. RTS, DTR) can be set and cleared normally. My machine is running Windows7/x64. I am using the CP210X VCP Driver version 6.7.4.261. What am I missing? Test C code, compiled in Visual Studio 2010, is in attachment. Br, Matej
Posts: 343
Registered: ‎03-03-2015

Re: SetCommBreak/ClearCommBreak problem with CP2102

Why are you trying to bit bang a serial interface, instead of using the built in UART the device provides?  If you are interested in more than one UART port, consider the CP2105 or CP2108.

 

Regards,

Joe

Posts: 2
Registered: ‎10-01-2017

Re: SetCommBreak/ClearCommBreak problem with CP2102

Hi, Joe The idea behind serial bit-banging is to implement a synchronous protocol, similar to SPI, called TPI (MOSI/MISO 3-stated in a single data line, clock same as SCK). Such a protocol is used by several small Atmel Tiny microcontrollers (e.g. Tiny10), which our students use for their projects. Since the students already use the CP2102 as a normal UART device, it would be best if we could re-use this module for TPI programming also. If I was to use CP2102 as a normal UART device, it would have to provide a driving signal for the 3-state driver, which would disable the master (PC) transmission signal during reception. As far as I know, CP2102 does not feature such a capability. Using bit-banging approach, this is possible (though really dead slow). However, microcontrollers which feature TPI, usually don't have more than 1k of FLASH. Regards, Matej