All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: David Frey <dpfrey@gmail.com>
Cc: linux-usb@vger.kernel.org,
	"Alex Villacís Lasso" <a_villacis@palosanto.com>
Subject: Re: CP210X: Failure while programming ESP32 dev board
Date: Fri, 4 Jun 2021 18:33:28 +0200	[thread overview]
Message-ID: <YLpV2NomCCGKf2zt@hovoldconsulting.com> (raw)
In-Reply-To: <CAAvkfd91qr+aQQxXyQfk1e2Avifcdp6fCwgrk3c7=ex3pcqvPw@mail.gmail.com>

On Thu, Jun 03, 2021 at 02:48:44PM -0700, David Frey wrote:
> Hi Johan,
> 
> I have added linux-usb@vger.kernel.org to the CC as requested.
> 
> > I just verified with a CP2102N here and everything appears to work as
> > expected as it also does with some of your boards. Could the CP2102N in
> > the board in question be configured differently in EEPROM?
> I would be surprised if the EEPROM of the failing devices were
> customized, but I'm not sure how to prove that there weren't modified.
> The CP2102N seems to identify with the default VID/PID, so that's
> evidence supporting the theory that it's not been modified.

It could be some other setting. I guess we could read out the entire
configuration blob and compare it to that of a working CP2102N just to
be sure.

> Now I upgraded to kernel 5.12.8 (after the bug) and when I plug in the
> device I get:

> 5.12.8: Before trying to flash the ESP32 using the CP2102N:
> $ stty -F /dev/ttyUSB0 -a
> speed 9600 baud; rows 0; columns 0; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
> ixon -ixoff -iuclc -ixany -imaxbel -iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
> -echoprt echoctl echoke -flusho -extproc
> 
> 5.12.8: Debug logs as a result of above stty command:
> [  507.773433] cp210x ttyUSB0: cp210x_change_speed - setting baud rate to 9600
> [  507.774216] cp210x ttyUSB0: cp210x_set_flow_control - ctrl = 0x00,
> flow = 0x01
> [  507.774450] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0303
> [  507.774673] cp210x ttyUSB0: failed set request 0x7 status: -32
> [  507.775273] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0300
> [  507.775454] cp210x ttyUSB0: failed set request 0x7 status: -32
> 
> 5.12.8: Debugs logs as a result of FAILED programming of ESP32:
> [ 1385.733008] cp210x ttyUSB0: cp210x_change_speed - setting baud rate to 9600
> [ 1385.733899] cp210x ttyUSB0: cp210x_set_flow_control - ctrl = 0x00,
> flow = 0x01
> [ 1385.734165] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0303
> [ 1385.734391] cp210x ttyUSB0: failed set request 0x7 status: -32
> [ 1385.735014] cp210x ttyUSB0: cp210x_set_flow_control - ctrl = 0x01,
> flow = 0x40
> [ 1385.735187] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0101
> [ 1385.735316] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0202
> [ 1385.735558] cp210x ttyUSB0: failed set request 0x7 status: -32
> [ 1385.735817] cp210x ttyUSB0: cp210x_tiocmset_port - control = 0x0300
> [ 1385.736082] cp210x ttyUSB0: failed set request 0x7 status: -32

Thanks a lot for testing this. You seem to have the same issue as the
one reported by Alex here a fews days after you:

	https://lore.kernel.org/r/465ef3ac-4291-6392-e52b-26cc0c34dd7c@palosanto.com

let's keep discussing in that thread. I added you on CC.

> 5.12.8: After failed programming:
> $ stty -F /dev/ttyUSB0 -a
> speed 9600 baud; rows 0; columns 0; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 0; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
> -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
> -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
> bs0 vt0 ff0
> -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
> -tostop -echoprt -echoctl -echoke -flusho -extproc
> 
> 
> It appears that in the 5.12.8 kernel, there is a failure every time
> cp210x_tiocmset_port is called resulting from this:
> ret = cp210x_write_u16_reg(port, CP210X_SET_MHS, control);

Indeed. Alex bisected it down to a commit setting the default IXOFF
thresholds. Not sure why that would cause the device to misbehave yet,
but we may need to stick with the default settings for CP2102N if we
can't figure it out.

Johan

      parent reply	other threads:[~2021-06-04 16:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAvkfd_vPHcd5CTLrA_BoVhg_aNWNzcp45yO-dCpJZhyabjjsg@mail.gmail.com>
     [not found] ` <YK4T+w+e8TtAUuEo@hovoldconsulting.com>
2021-06-03 21:48   ` CP210X: Failure while programming ESP32 dev board David Frey
2021-06-03 22:56     ` Alex Villacís Lasso
2021-06-04 16:38       ` Johan Hovold
2021-06-04 16:33     ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLpV2NomCCGKf2zt@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=a_villacis@palosanto.com \
    --cc=dpfrey@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.