I've been trying to get the msd code on Chibios-Contrib (https://github.com/ChibiOS/ChibiOS-Contrib) to work in a composite device. I've previously created a solid cdc + bulk composite device, so I didn't expect huge problems, but that was optimistic. Here's where I am
1) msd alone. Works (mostly), but doesn't always remount on OS X . More reliable on Linux. I did have to comment a couple of usb otg statements in hal_usb_msd.c to get this to compile stm32l432.
2) cdc alone. Works great
3) msd + cdc. the drive doesn't mount at all. Equally confusing is that screen on OS X drops (resets ?) the tty after 30-60 seconds. If I use a chibios shell with exit disabled, that thread doesn't seem to notice. I can reconnect screen as if nothing happened. My first thought was something with the EP0 setup packets, but I've tried tightening up that code to no avail.
I'm not really sure where to go next. Any suggestions ? Anybody have a successful CDC + MSC project ?
Geoffrey
cdc + msd woes
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
-
- Posts: 87
- Joined: Thu May 07, 2015 9:47 pm
- Has thanked: 3 times
- Been thanked: 15 times
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: cdc + msd woes
Hi,
The problem is most likely in USB descriptors, I don't have examples. If you find a composite device CDC+MSC then it would be a good idea to see how descriptors are done.
Giovanni
The problem is most likely in USB descriptors, I don't have examples. If you find a composite device CDC+MSC then it would be a good idea to see how descriptors are done.
Giovanni
-
- Posts: 87
- Joined: Thu May 07, 2015 9:47 pm
- Has thanked: 3 times
- Been thanked: 15 times
Re: cdc + msd woes
Actually, the descriptors weren't the problem. It turned out that OS X did not like the way msd_request_hook handles MSD_GET_MAX_LUN and this, coupled with the fact that the handling of CBW messages with LUN other than zero in hal_usb_msd.c is poor (essentially no response) caused OS X to take drastic action (I'm not sure exactly how this affected the serial usb interface).
In fact, lib_scsci.c should be passed the LUN and handle any errors there. Some commands (request sense) should not fail. Simply not responding is almost certainly the wrong thing.
After I changed the way msd_request_hook responds, all seems quiet. Rather than stalling EP0, I did the following:
static const uint8_t zbuf = 0;
usbSetupTransfer(usbp, &zbuf, 1, NULL);
I don't know why stalling EP0 doesn't work on OS X, but it led to a cascade of problems.
Geoffrey
In fact, lib_scsci.c should be passed the LUN and handle any errors there. Some commands (request sense) should not fail. Simply not responding is almost certainly the wrong thing.
After I changed the way msd_request_hook responds, all seems quiet. Rather than stalling EP0, I did the following:
static const uint8_t zbuf = 0;
usbSetupTransfer(usbp, &zbuf, 1, NULL);
I don't know why stalling EP0 doesn't work on OS X, but it led to a cascade of problems.
Geoffrey
Who is online
Users browsing this forum: No registered users and 8 guests