Reply
Posts: 5
Registered: ‎02-23-2017
Accepted Solution

CP2102N Strange Issue

Hello,

 

I've designed my first CP2102N board and I've a strange issue with CP2102N.

 

I'm sending data from Arduino in loop() function something like that:

 

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);

  // print the results to the serial monitor:
  Serial.print("sensor = ");
  Serial.println(sensorValue);

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(100);
}

Arduino continuously send this data with 100ms delay. Everytime I connect to serial port, I can see the data. Everything is working normally with 100ms delay.

 

When I change 100ms delay to 2ms delay, and connect to Serial port, I can see the data again but after disconnect and reconnect, no data is coming thru CP2102N serial port.

 

Why this happening?

 

Here is the quick demonstration:

 

Here is my schematic:

SCHEMATIC

Thak you.

 

 

Posts: 5
Registered: ‎02-23-2017

Re: CP2102N Strange Issue

I think there is an issue with CP2102N Mac OS driver. I tried on Windows, everthing is good. On Mac OS 10.9 and 10.11, it's not working as expected.

Posts: 312
Registered: ‎03-03-2015

Re: CP2102N Strange Issue

Hamit,

 

I'm looking into this issue with the firmware team.  Does this problem only happen on your board, or can you reproduce it on an evaluation kit?  Are you using flow control?  What is the purpose of the signal connected to the DTR pin, and the series capacitor?

 

Regards,

Joe

Posts: 5
Registered: ‎02-23-2017

Re: CP2102N Strange Issue

jstine,

 

I don't have CP2102N Evaluation Kit. The problem is occurring only on Mac OS with or without flow control. I have two different boards with CP2102N, same issue on Mac OS. I've also soldered CP2104 to another board, everything is normal and working. I think it's driver issue on Mac OS. Like on the video above, first connect to serial port is OK, second connection is failing. So I have to reset CP2102N everytime to reconnect again.

 

DTR pin resets the slave device for enter bootloader.

 

To summarize:

  • Problem is only on Mac OS. On Windows, everything is normal.
  • Problem arises when slave device sends data very frequently to CP2102N. (i.e. with 2ms delay.)
  • First connection to serial port is OK, second connection fails.
Posts: 35
Registered: ‎04-05-2013

Re: CP2102N Strange Issue

To be clear - you are saying that the CP2102N has this behavior but the CP2104 does not, when used in the same situation?  I'm trying to narrow it down to the problem being something in CP2102N or the Mac driver.  Thanks.

Posts: 5
Registered: ‎02-23-2017

Re: CP2102N Strange Issue

Yes. Only CP2102N has this behavior on Mac OS in the same situation.

 

Thank you.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

I can confirm that there is a problem with the CP2102N under MacOS. We have some customers who reported problems with our ESP-WROOM-32-Breakout with CP2102N as USB-UART bridge.

https://esp32.com/viewtopic.php?f=13&t=1287

https://github.com/espressif/esp-idf/issues/427

Highlighted
Posts: 18
Registered: ‎01-17-2017

Re: CP2102N Strange Issue

Hi. I have a few questions about the problem you are seeing.

In the video it appears to be receiving data until you disconnect and reconnect in CoolTerm. What happens if you do not disconnect?

What are the settings on the Mac side? Could it be the case that the Mac is using hardware flow control and asserting DTR causing the arduino to change its behavior?

I would suggest trying no flow control, CTS/RTS flow control, DSR/DTR flow control, and both types of flow control and record your results for each of these. It might make it more clear what is happening.

What happens if you vary the baud rate? My best guess at this point is that when you have the 10ms delay the buffer on the CP2102N doesn't fill up and assert DTR, but when you have 2ms delay that happens. Possibly if you increased the baud rate you would see the problem occur less frequently. I would try systematically varying the baud rate and recording results to try to get a better understanding as to what is occuring.

Do you have access to a logic analyzer or oscilloscope to see what is happening when data is not being received on the Mac? I would check to see if the arduino is still sending the data and also look at the state of the DTR line.

I'd like to help you with this, so please let me know what you find. If it is a bug in our Mac driver or in the CP2102N firmware, we would very much like to isolate and correct it.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

We have not done further testings, but the problem occurs only on MacOS when a lot of data is sent (without flow control) to the CP2102N and the serial port is closed and then re-opened (data is sent also while the serial port is closed). After the re-opening no data is received - only after a complete disconnect and reconnect from USB.

 

Posts: 7
Registered: ‎03-25-2017

Re: CP2102N Strange Issue

I have the same issue with Linux.

Posts: 3
Registered: ‎03-30-2017

Re: CP2102N Strange Issue

Any news regarding this issue? Is there a bug tracker entry somewhere?

Posts: 18
Registered: ‎01-17-2017

Re: CP2102N Strange Issue

When you say "the same issue on Linux", can you describe in a little more detail what you mean? Can you list the steps I would need to take in order to reproduce the issue?

 

Thanks.

Posts: 18
Registered: ‎01-17-2017

Re: CP2102N Strange Issue

[ Edited ]

I attempted to reproduce the problem reported. I didn't have an arduino handy to test with, but I did the following:

I connected two CP2102N eval boards using a NULL modem cable. I connected one to a Mac and one to a Linux PC. I ran CoolTerm on Mac using the same settings (115200 baud, 8-N-1). I wrote a program in C on the Linux PC which was intended to be similar to the Arduino sketch. Instead of using an ADC, I sent a random number. I set the delay to 2ms and varied it in the course of different tests between 2 ms, 10 us, and 100us.

 

I tried connecting and disconnecting using CoolTerm but I did not experience the problem reported. I have attached a screen movie of CoolTerm and an ssh session into the Linux PC. If anyone experiencing this issue can find a way to tweak my scenario to reproduce the issue, I would appreciate it.

 

 

#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <stdbool.h>
#include <string.h>

bool gKeepGoing = true;

void sighandler(int signal) {
  printf("Signal caught.\n");
  gKeepGoing = false;
}

void sendingLoop(int fd) {
  while (gKeepGoing) {
    write(fd, "sending...", 10);
    char buf[10];
    long r = random();
    sprintf(buf, "%lu\n", r);
    write(fd, buf, strlen(buf));
    usleep(2000);
  }
  printf("Exiting sending loop.\n");
}

int main(int argc, const char * argv[]) {
  // setup to cat ch signal
  signal(SIGINT, sighandler);

  if (argc <= 1) {
    printf("The device is required.\n");
    return -1;
  }
  const char * device_path = argv[argc - 1];

  if (access(device_path, F_OK) != -1) {
    // file exists
    int fd = open(device_path, O_RDWR, 0);
    printf("Device opened: %d\n", fd);
    // sending loop
    sendingLoop(fd);
    close(fd);
  } else {
    printf("Device not found.\n");
    return -1;
  }
  return 0;
}

 

 

Posts: 3,091
Registered: ‎02-07-2002

Re: CP2102N Strange Issue

@_brant

Next time please use the SiLabs Insert Code.png"Insert Code" button to insert code so that its indentation is preserved.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

I have done some testings with Linux as receiver (Raspberry Pi) and an Arduino Uno as transmitter.

The Arduino sends at 115200 baud and when I open the serial port on Linux then it works the first time, but not if I close the connection and re-open it immediately. If I wait a short time after the closing then the re-opening works. When the connection fails one time, it is not possible to get it working again without a disconnect from USB. On Linux I used minicom as serial program.

Maybe a PC as transmitting device is too slow.

 

Raspberry Pi:

sudo minicom -b 115200 -D /dev/ttyUSB0

Arduino code:

void setup() {
  Serial.begin(115200);
}

void loop() {
  static int i=0;
  Serial.println(i++, DEC);
  Serial.flush();
}



Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

A customer of us could also fix the issue on MacOS, when there is a short pause between the closing and re-opening of the serial port.

Further infos here: https://esp32.com/viewtopic.php?f=13&t=1287#p7637

Posts: 5
Registered: ‎02-23-2017

Re: CP2102N Strange Issue

I've received CPM2102N-MINIEK evaluation board today and did a quick test. Same problem on Mac OS 10.9.

 

Here's the video:

Posts: 18
Registered: ‎01-17-2017

Re: CP2102N Strange Issue

I attempted to reproduce this again using an Arduino UNO and a CP2102N-EB. I used the sketch provided:

 

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  randomSeed(analogRead(0));

}

void loop() {
  // put your main code here, to run repeatedly:
  // read the analog in value:

  int sensorValue = random(1, 100);

  // print the results to the serial monitor:
  Serial.print("sensor = ");
  Serial.println(sensorValue);

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2);
}

And connected the Tx pin of the arduino to the Rx pin of the CP2102N-EB. I used CoolTerm running on MacOS X 10.11.6. I am able to connect and disconnect many times without experiencing the reported problem (i.e. inability to connect to the CP2102N). I have provided a video and picture of how I'm doing this.

 

If you can tell me what I might do differently to reproduce the issue, I will be grateful.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

Can you try the Arduino program that I have posted (without any delay)?

When I made the tests, the issue only happens on a fast close and re-open. On the computer I used minicom and I closed it and reopened it via the keyboard (I think at <200ms).

The same situation also happens on our development boards with the issue. There is a firmware upload via one tool and then the port is closed and re-opened from a monitor tool. In the mean time the microcontroller starts and sends serial data.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

Here is a video (MP4) when the issue happened after I opened and closed minicom a few times. As you can see on the Tx LED the Arduino sends data all the time.

Connection: Notebook  <-LAN/SSH->  Pi  <-USB->  CP2102N  <-SERIAL->  Arduino

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

The marking of the CP2102N is

manufacturing code: AODEFM

date code: 1608

revision: A

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

There is a section in the PCN #1611215:

 

Spoiler
Silicon Labs is also pleased to announce the following Errata update:
The CP2102N A01 errata includes the following errata for A01 revision. These issues will be solved in
A01 devices with a date code of 1639 or later.
1. Systems using CP2102N may see devices fail to respond until a power-on reset. If a device fails
to respond properly, remove and replace power until the device properly responds. Devices with a
date code of 1639 or later will not have this issue.

What does this mean, are all devices with a date code before 1639 faulty?

 

 

Posts: 79
Registered: ‎10-06-2014

Re: CP2102N Strange Issue

This was a potential issue caught during a review of the init code.  If a register matches 0xa5 during reset, then the CP2102n will not start correctly. No instances of this happening in the field have been reported, however I felt it necessary to issue a firmware update.  This would only occur during a power on/reset condition, and only if the register happened to start with that value. Date codes 1639 and later will have the firmware fix.

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

What will happen, when the device does not start correctly.

Will the CP2102N completely not work (no USB connection) or will there be problems/issues?

Can a reset be triggered by the described opening/closing of the serial connection via USB?

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

If the CP2102N hangs then a hard reset (reset pin set to GND) or a reset of the USB device under Linux will bring it back.
An unload and reload of the kernel module has no effect.

Posts: 312
Registered: ‎03-03-2015

Re: CP2102N Strange Issue

We've reproduced the original issue, we did not see it at first because we were using an older version of the part.  We are working on an updated driver to fix the issue.

 

Regards,

Joe

Posts: 11
Registered: ‎10-19-2016

Re: CP2102N Strange Issue

Since you reproduced it, what is exactly causing the issue/freezing and when have you planned to release the updated driver?

Posts: 312
Registered: ‎03-03-2015

Re: CP2102N Strange Issue

We are still working on fixing the issue, and do not have a schedule for the updated driver.

 

Regards,

Joe

Posts: 201
Registered: ‎07-27-2016

Re: CP2102N Strange Issue

Update - 

 

We have identified the problem and are working on a solution in the driver.  We will release an updated driver as soon as we have completed a fix and tested it.  The problem has to do with state synchronization between the driver and the device.  It is not related to the PCN at all.
 
In the mean time, there is a workaround you can try, but it involves a change in the device configuration.  Disabling RX FIFO flush on open prevents the lockup. However, the CP2102N will buffer any received data after closing, and attempt to provide it to the driver once the interface is re-opened. The CP2102N will eventually fill up with data and overflow if left disabled while receiving data if flow control is disabled.  If flow control is enabled, the CP2102N will fill up and notify the sender to stop transmitting.  If you disable the RX FIFO flush, when you re-open the device, it is possible that you could immediately receive a block of stale data (data that was incoming when the device was closed). The end use application will need to be able tolerate these effects/notifications.
 
This short term fix will not be necessary once the driver is updated.
 
To disable RX FIFO flush, use Xpress Configurator from Simplicity Studio:

  1. Install Simplicity Studio
  2. Connect CP2102N
  3. From the Launcher view Device window, select the CP2102N device.
  4. From the Launcher view, select Compatible Tools
  5. Press Add/Remove Tools
  6. Select Xpress Configurator, and complete the install process.
  7. From the Launcher view, select Compatible Tools, then start Xpress Configurator
  8. Import from Device to read the current settings.
  9. Deselect Flush Buffers On Open for UART0 RX.
  10. Select Program to Device

 

-Manasa

Posts: 3
Registered: ‎03-30-2017

Re: CP2102N Strange Issue

Any updates? I don't see a new driver download yet.

Posts: 492
Registered: ‎02-04-2013

Re: CP2102N Strange Issue

[ Edited ]

Hi All,

 

Here is a new build of the Mac OS X Driver:

 

Version 4.11.0
Fixed an issue that would cause the CP2102N to hang when a user space application disconnects while the device is receiving data.

 

Updated: This is an official build that will be posted to the www.silabs.com driver downloads page in the next week or so.

 

Updated: The 4.11.0 Mac OSX VCP driver update has gone live.  Get the latest version and release notes here:

http://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

 

Best regards,

Chris

Posts: 3
Registered: ‎03-30-2017

Re: CP2102N Strange Issue

Thanks Chris, looks like its fixed.