I did a version for the STM32F4 which you can find here:
https://github.com/dhylands/libopencm3-usb-serial/blob/master/usb-serial.c

I set things up to call usbd_poll from the isr handler:
https://github.com/dhylands/libopencm3-usb-serial/blob/master/usb.c#L290-L295

and then uses the SOF handler to transfer bytes into a circular buffer.


On Thu, Mar 2, 2017 at 3:00 PM, kristoff <krist...@skypro.be> wrote:

> Hi,
>
>
> Can somebody explain how to really use the CDC ACM (serial over usb) on
> a STM32F1?
>
>
> In libopencm3-examples, there is an example on using cdc acm
> (serial-over-usb), however I cannot modify the example to do something
> usefull.
>
> The example only sets up the cdcacm-device and then does two things:
> - there is an endless loop that just does usbd_poll
> - inside the callback function, there is some code that echoes the
> characters it received back to the usb-device.
>
>
> But how do you write an application that actually does something usefull?
> When I modify the "usbd_poll" loop to actually does something (like just
> print out a line "count = ...", this results in errors when I boot the
> device (i.e. "Device not responding to setup address.").
>
> So it looks like you really need to have this continues-cycle of the
> usbd_poll running.
>
>
> So how I you actually make an application that uses that cdcacm
> interface and make it actually do something usefull?
>
>
>
> Cheerio! Kr. Bonne.
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> libopencm3-devel mailing list
> libopencm3-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
>



-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to