<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openmano-mpy/ports/stm32/usbdev/class/inc, branch master</title>
<subtitle>MicroPython source and hardware configuration for OpenMano</subtitle>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/'/>
<entry>
<title>stm32/usbdev: Fix calculation of SCSI LUN size with multiple LUNs.</title>
<updated>2020-07-24T15:12:07+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-07-22T13:45:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=fd2ff867a08fd174f0bbf7a03aa59547634e91ac'/>
<id>fd2ff867a08fd174f0bbf7a03aa59547634e91ac</id>
<content type='text'>
The SCSI driver calls GetCapacity to get the block size and number of
blocks of the underlying block-device/LUN.  It caches these values and uses
them later on to verify that reads/writes are within the bounds of the LUN.
But, prior to this commit, there was only one set of cached values for all
LUNs, so the bounds checking for a LUN could use incorrect values, values
from one of the other LUNs that most recently updated the cached values.
This would lead to failed SCSI requests.

This commit fixes this issue by having separate cached values for each LUN.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The SCSI driver calls GetCapacity to get the block size and number of
blocks of the underlying block-device/LUN.  It caches these values and uses
them later on to verify that reads/writes are within the bounds of the LUN.
But, prior to this commit, there was only one set of cached values for all
LUNs, so the bounds checking for a LUN could use incorrect values, values
from one of the other LUNs that most recently updated the cached values.
This would lead to failed SCSI requests.

This commit fixes this issue by having separate cached values for each LUN.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Verify number of used endpoints doesn't exceed maximum.</title>
<updated>2019-09-11T05:17:38+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-09-11T04:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=bcaafa382323c5d15988f20782c2737f05a4c002'/>
<id>bcaafa382323c5d15988f20782c2737f05a4c002</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Add support for VCP+MSC+HID mode, incl 2xVCP and 3xVCP.</title>
<updated>2019-09-11T05:17:38+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-07-05T14:19:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=6705767da1f7dba7a04e1d16c380a650f1f1074f'/>
<id>6705767da1f7dba7a04e1d16c380a650f1f1074f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Add config options to disable USB MSC and/or HID.</title>
<updated>2019-07-16T04:39:21+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-07-16T04:39:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=f302f784e96f0b7daa019b282bdf66c1792eec34'/>
<id>f302f784e96f0b7daa019b282bdf66c1792eec34</id>
<content type='text'>
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be
used by a board to enabled or disable MSC and/or HID.  They are both
enabled by default.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be
used by a board to enabled or disable MSC and/or HID.  They are both
enabled by default.
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usbd_msc: Provide Mode Sense response data in MSC interface.</title>
<updated>2019-06-11T05:43:59+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-06-11T05:35:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=38bcc99a586d7d6e5f51fcb330a12c4c42007162'/>
<id>38bcc99a586d7d6e5f51fcb330a12c4c42007162</id>
<content type='text'>
Eventually these responses could be filled in by a function to make their
contents dynamic, depending on the attached logical units.  But for now
they are fixed, and this patch fixes the MODE SENSE(6) responses so it is
the correct length with the correct header.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Eventually these responses could be filled in by a function to make their
contents dynamic, depending on the attached logical units.  But for now
they are fixed, and this patch fixes the MODE SENSE(6) responses so it is
the correct length with the correct header.
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usbd_msc: Provide custom irquiry processing by MSC interface.</title>
<updated>2019-06-11T05:43:58+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-06-11T05:23:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=829aa58c5ca5dc9681b642c27c9a6906957ca643'/>
<id>829aa58c5ca5dc9681b642c27c9a6906957ca643</id>
<content type='text'>
So the MSC interface can customise the inquiry response based on the
attached logical units.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
So the MSC interface can customise the inquiry response based on the
attached logical units.
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Include py/mpconfig.h instead of mpconfigboard.h.</title>
<updated>2019-05-31T11:39:34+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-05-31T11:39:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=3fc7c8e35c24942f1b44eb99e0aba9cf77ab984c'/>
<id>3fc7c8e35c24942f1b44eb99e0aba9cf77ab984c</id>
<content type='text'>
Because py/mpconfig.h has header include guards.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Because py/mpconfig.h has header include guards.
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Support up to 3 VCP interfaces on USB device peripheral.</title>
<updated>2019-05-31T01:35:42+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-05-30T07:16:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=ff91b05cfa8154d1a4d098423dfa95d14ade4271'/>
<id>ff91b05cfa8154d1a4d098423dfa95d14ade4271</id>
<content type='text'>
To enable define MICROPY_HW_USB_CDC_NUM to 3.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To enable define MICROPY_HW_USB_CDC_NUM to 3.
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usb: Refactor CDC VCP code to enable N CDC interfaces.</title>
<updated>2019-05-30T11:11:04+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2019-05-18T13:01:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=0c29502ad995cfacc3b11f26a135707a06b8c27d'/>
<id>0c29502ad995cfacc3b11f26a135707a06b8c27d</id>
<content type='text'>
The board config option MICROPY_HW_USB_ENABLE_CDC2 is now changed to
MICROPY_HW_USB_CDC_NUM, and the latter should be defined to the maximum
number of CDC interfaces to support (defaults to 1).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The board config option MICROPY_HW_USB_ENABLE_CDC2 is now changed to
MICROPY_HW_USB_CDC_NUM, and the latter should be defined to the maximum
number of CDC interfaces to support (defaults to 1).
</pre>
</div>
</content>
</entry>
<entry>
<title>stm32/usbd_cdc_interface: Refactor USB CDC tx code to not use SOF IRQ.</title>
<updated>2018-10-15T04:37:01+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2018-10-15T04:35:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=0f6f86ca4935385fd4fe67f30465f2976aa9f97d'/>
<id>0f6f86ca4935385fd4fe67f30465f2976aa9f97d</id>
<content type='text'>
Prior to this commit the USB CDC used the USB start-of-frame (SOF) IRQ to
regularly check if buffered data needed to be sent out to the USB host.
This wasted resources (CPU, power) if no data needed to be sent.

This commit changes how the USB CDC transmits buffered data:
- When new data is first available to send the data is queued immediately
  on the USB IN endpoint, ready to be sent as soon as possible.
- Subsequent additions to the buffer (via usbd_cdc_try_tx()) will wait.
- When the low-level USB driver has finished sending out the data queued
  in the USB IN endpoint it calls usbd_cdc_tx_ready() which immediately
  queues any outstanding data, waiting for the next IN frame.

The benefits on this new approach are:
- SOF IRQ does not need to run continuously so device has a better chance
  to sleep for longer, and be more responsive to other IRQs.
- Because SOF IRQ is off, current consumption is reduced by a small amount,
  roughly 200uA when USB is connected (measured on PYBv1.0).
- CDC tx throughput (USB IN) on PYBv1.0 is about 2.3 faster (USB OUT is
  unchanged).
- When USB is connected, Python code that is executing is slightly faster
  because SOF IRQ no longer interrupts continuously.
- On F733 with USB HS, CDC tx throughput is about the same as prior to this
  commit.
- On F733 with USB HS, Python code is about 5% faster because of no SOF.

As part of this refactor, the serial port should no longer echo initial
characters when the serial port is first opened (this only used to happen
rarely on USB FS, but on USB HS is was more evident).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prior to this commit the USB CDC used the USB start-of-frame (SOF) IRQ to
regularly check if buffered data needed to be sent out to the USB host.
This wasted resources (CPU, power) if no data needed to be sent.

This commit changes how the USB CDC transmits buffered data:
- When new data is first available to send the data is queued immediately
  on the USB IN endpoint, ready to be sent as soon as possible.
- Subsequent additions to the buffer (via usbd_cdc_try_tx()) will wait.
- When the low-level USB driver has finished sending out the data queued
  in the USB IN endpoint it calls usbd_cdc_tx_ready() which immediately
  queues any outstanding data, waiting for the next IN frame.

The benefits on this new approach are:
- SOF IRQ does not need to run continuously so device has a better chance
  to sleep for longer, and be more responsive to other IRQs.
- Because SOF IRQ is off, current consumption is reduced by a small amount,
  roughly 200uA when USB is connected (measured on PYBv1.0).
- CDC tx throughput (USB IN) on PYBv1.0 is about 2.3 faster (USB OUT is
  unchanged).
- When USB is connected, Python code that is executing is slightly faster
  because SOF IRQ no longer interrupts continuously.
- On F733 with USB HS, CDC tx throughput is about the same as prior to this
  commit.
- On F733 with USB HS, Python code is about 5% faster because of no SOF.

As part of this refactor, the serial port should no longer echo initial
characters when the serial port is first opened (this only used to happen
rarely on USB FS, but on USB HS is was more evident).
</pre>
</div>
</content>
</entry>
</feed>
