microbit-foundation / DAPLink

This DAPLink fork is only for development - everything is submitted upstream - please file issues on https://github.com/ARMmbed/DAPLink
Apache License 2.0
9 stars 2 forks source link

setting serial speed resets target #6

Open mmoskal opened 3 years ago

mmoskal commented 3 years ago

the Vendor2 command (0x82) which is used to set the line speed also sends a break:

https://github.com/microbit-foundation/DAPLink/blob/master/source/daplink/cmsis-dap/DAP_vendor.c#L93

this resets the target:

https://github.com/microbit-foundation/DAPLink/blob/master/source/daplink/usb2uart/usbd_user_cdc_acm.c#L130

I don't thinks v1 was doing this, and I think this is why makecode resets the board twice while flashing over WebUSB.

cc @jaustin

microbit-carlos commented 3 years ago

Right, so the code was introduced in version 0251 (https://github.com/microbit-foundation/DAPLink-microbit/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and we shipped v1.5 with 0249.

However we've been putting the newer versions on the website to upgrade not long after each release, so we have users with these versions.

I can replicate the issue in a v1 with 0254 with the current MakeCode beta:

makecode.microbit.org version: 3.0.28 Microsoft MakeCode version: 6.0.24 microbit runtime version: v2.2.0-rc6

mmoskal commented 3 years ago

Do we think it's the right behavior? It seems odd for baud setting to reset board.

microbit-carlos commented 3 years ago

Yeah, doesn't sound right to reset the target on a baud rate change. We should raise this issue upstream and we can ask Arm if this was an intentional change.

In the meantime the new factory image shipped contains this, and if we want to update the DAPLink factory image I would prefer to do that with an official 0256 release (we don't want to have two different 0255 images in the wild), which might take time since we need to submit the PR upstream and go through the review process to get it merged. So that's not going to be quick.

microbit-carlos commented 3 years ago

Related issue upstream (thanks for the find @gerargz): https://github.com/ARMmbed/DAPLink/issues/613

mmoskal commented 3 years ago

I think this is orthogonal to the issue that setting baud rate sends break - i don't see why it should