Hi all,
I use hal_usb driver in ChibiOS_17.6.3 to transmit data from a STM32 device to host computer.
I start transfer with the usbStartTransmitI(), and wait for the "data transmitted" interrupt.
The question is: how can I prematurely abort the transfer which is already started?
Regards,
Vladimir
How to abort USB transmit?
-
- Posts: 35
- Joined: Fri Feb 09, 2018 12:44 am
- Has thanked: 2 times
- Been thanked: 5 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: How to abort USB transmit?
Hi,
The driver is not able to interrupt ongoing transactions, you may split transaction in smaller ones and check an "abort" flag before starting the next one.
Giovanni
The driver is not able to interrupt ongoing transactions, you may split transaction in smaller ones and check an "abort" flag before starting the next one.
Giovanni
-
- Posts: 35
- Joined: Fri Feb 09, 2018 12:44 am
- Has thanked: 2 times
- Been thanked: 5 times
- sabdulqadir
- Posts: 49
- Joined: Fri Mar 23, 2018 7:29 pm
- Has thanked: 13 times
- Been thanked: 4 times
Re: How to abort USB transmit?
Hi Giovanni,
If we need a for-sure way to abort a transaction (or time it out), no matter how small, how would you think we should proceed?
I am guessing this would mean "getting under the hood".
Thanks,
AQ
If we need a for-sure way to abort a transaction (or time it out), no matter how small, how would you think we should proceed?
I am guessing this would mean "getting under the hood".
Thanks,
AQ
- 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: How to abort USB transmit?
Hi,
You should find a way to reset the endpoint at register level then stop the driver to clean up everything.
Giovanni
You should find a way to reset the endpoint at register level then stop the driver to clean up everything.
Giovanni
- sabdulqadir
- Posts: 49
- Joined: Fri Mar 23, 2018 7:29 pm
- Has thanked: 13 times
- Been thanked: 4 times
Re: How to abort USB transmit?
Hi Giovanni,
Attached is a patch I did to timeout on USB transactions. Can you check it out and help provide some feedback?
Any red flags, any concerns etc.
Thanks,
AQ
Attached is a patch I did to timeout on USB transactions. Can you check it out and help provide some feedback?
Any red flags, any concerns etc.
Thanks,
AQ
- Attachments
-
- introduction_timeout_for_usbTransmit_usbReceive.patch.zip
- (2.22 KiB) Downloaded 168 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: How to abort USB transmit?
Hi,
The only concern is that it would break other USB implementations some of which I don't manage.
Giovanni
The only concern is that it would break other USB implementations some of which I don't manage.
Giovanni
- sabdulqadir
- Posts: 49
- Joined: Fri Mar 23, 2018 7:29 pm
- Has thanked: 13 times
- Been thanked: 4 times
Re: How to abort USB transmit?
So which implementation are you talking about?
We are not changing any of the existing code. So existing implementation should not be affected. If they start using the new API, you are worried it would break?
Any way to get them on board?
Thanks,
AQ
We are not changing any of the existing code. So existing implementation should not be affected. If they start using the new API, you are worried it would break?
Any way to get them on board?
Thanks,
AQ
- 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: How to abort USB transmit?
Hi,
There are the STM32 USBv1 and the AVR official drivers (which I don't even handle), some others are not in the official repository.
This is the problem with changes that break the LLD API, it needs a way to fit on top of current, unmodified LLDs. LLDs could export something like USB_LLD_SUPPORTS_TIMEOUTS, other drivers do this, see SPI and circular API support, not all LLDs support that.
It is not a big deal if handled properly.
Moving this topic in "change requests".
Giovanni
There are the STM32 USBv1 and the AVR official drivers (which I don't even handle), some others are not in the official repository.
This is the problem with changes that break the LLD API, it needs a way to fit on top of current, unmodified LLDs. LLDs could export something like USB_LLD_SUPPORTS_TIMEOUTS, other drivers do this, see SPI and circular API support, not all LLDs support that.
It is not a big deal if handled properly.
Moving this topic in "change requests".
Giovanni
- sabdulqadir
- Posts: 49
- Joined: Fri Mar 23, 2018 7:29 pm
- Has thanked: 13 times
- Been thanked: 4 times
Re: How to abort USB transmit?
Awesome, thanks.
Do I need to do anything on my end to help?
Thanks,
AQ
Do I need to do anything on my end to help?
Thanks,
AQ
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 19 guests