Page 4 of 4

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Thu Jun 14, 2012 10:59 am
by Badger
indigos wrote:
Badger wrote:On my linux I wrote a simple udev rule.

Thanks for those, they look handy. I ended up adding my user to the 'dialout' group which allowed me to access ttyACM0.

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Thu Jun 14, 2012 9:34 pm
by indigos
Tectu wrote:I've never cared about USB before. Is there now any working example, which demonstrates how to use the USB driver of ChibiOS to do some stuff like USB HID or something else?

There is testhal/STM32F1xx/USB_MSC but I don't know is working. Actually I see only USB-CDC.
Tectu wrote:Maybe someone also got a linux-side example showing how to use the new /dev device?
for linux-side is better to use lib-usb.
- is present in every linux distributions
- lib-usb works also in windows and macosx so your code should be work also in other OS
- there are many projects and many examples for lib-usb
- very easy to use with good documentation

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Thu Jun 14, 2012 9:57 pm
by Giovanni
The MSC demo is not complete yet, it has been there for a while but always something with higher priority happens...

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sat Jun 16, 2012 11:03 pm
by MartinP
Hi Giovanni,

your latest checkin for otgv1\usb_lld.c missed one rename dw-->w in line 334: *fifop = dw;
if I rename it to *fifop = w then compile works again

regards

Martin

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sun Jun 17, 2012 6:01 am
by Giovanni
Hi Martin,

Fixed thanks.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Mon Jul 02, 2012 7:40 pm
by Badger

Code: Select all

void sduDataTransmitted(USBDriver *usbp, usbep_t ep) {
  size_t n;
  SerialUSBDriver *sdup = usbp->param;

  (void)ep;

  chSysLockFromIsr();
  chnAddFlagsI(sdup, CHN_OUTPUT_EMPTY);

  if ((n = chOQGetFullI(&sdup->oqueue)) > 0) {
    /* The endpoint cannot be busy, we are in the context of the callback,
       so it is safe to transmit without a check.*/
    chSysUnlockFromIsr();

    usbPrepareQueuedTransmit(sdup->config->usbp,
                             USB_CDC_DATA_REQUEST_EP,
                             &sdup->oqueue, n);

    chSysLockFromIsr();
    usbStartTransmitI(sdup->config->usbp, USB_CDC_DATA_REQUEST_EP);
  }

  chSysUnlockFromIsr();
}


is there a reason why usbPrepareQueuedTransmit and usbStartTransmitI both get a pointer to the USBDriver with sdup->config->usbp, rather than the seemingly obvious pointer that was passed to the function? (usbp)

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Mon Jul 02, 2012 7:47 pm
by Giovanni
There were other instances too, thanks for finding. Apparently just because I copied the code from the queue callbacks where "usbp" is not a parameter.

Giovanni