- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
we are using FX3 for bulk transfers. I have assigned GPIO45 to be connected to the LED and control its ON/OFF state from the code. This part works fine. Now I need to lit it only when we transfer data over USB. I tried to use input->buffer_p.count in DMA Callback function but it seems it's always set to buffer size. How can I find if we are actually sending or receiving data over USB?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Note that the DMA Callback occurs in two cases:
1. The buffer is full
2. Short Packet or zero packets received
You might be sending a full buffer of data and looking for it in the DMA Callback.
Please let me know whether how many BULK Endpoints are used in your application.
If you set the DMA Channels in Manual mode, you can set the GPIO to high when there is a producer event in DMA callback.
Use a timer in which you need to turn off the LED, if there is no DMA callback after a TIME_PERIOD.
This timer needs to be reset when there is a producer event hence the LED keeps blinking.
This is not possible with AUTO DMA Channel.
You may use Events to turn on and turn off the LED in DMA callback and look for the event in the main thread.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Note that the DMA Callback occurs in two cases:
1. The buffer is full
2. Short Packet or zero packets received
You might be sending a full buffer of data and looking for it in the DMA Callback.
Please let me know whether how many BULK Endpoints are used in your application.
If you set the DMA Channels in Manual mode, you can set the GPIO to high when there is a producer event in DMA callback.
Use a timer in which you need to turn off the LED, if there is no DMA callback after a TIME_PERIOD.
This timer needs to be reset when there is a producer event hence the LED keeps blinking.
This is not possible with AUTO DMA Channel.
You may use Events to turn on and turn off the LED in DMA callback and look for the event in the main thread.
Regards,
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shidar,
thank you for prompt response. We have two bulk endpoints, one for IN direction and one for OUT direction.
Interface descriptor info is listed below.
Our firmware is based on slave fifo example code. I think I know how to control LED ON and OFF, I make it blink when we have open connection to our program but it blinks all the time.
Now I need only limit it to the moments when we actually send data over bulk endpoint. Your help is appreciated.
<INTERFACE 0>
<INTERFACE>
Interface="0"
InterfaceNumber="0"
AltSetting="0"
Class="FFh"
Subclass="00h"
Protocol="0"
Endpoints="2"
DescriptorType="4"
DescriptorLength="9"
<ENDPOINT>
Type="BULK"
Direction="OUT"
Address="01h"
Attributes="02h"
MaxPktSize="1024"
DescriptorType="5"
DescriptorLength="7"
Interval="0"
<SUPER SPEED ENDPOINT COMPANION>
Type="SUPERSPEED_USB_ENDPOINT_COMPANION"
MaxBurst="0"
Attributes="00h"
BytesPerInterval="00h"
</ENDPOINT>
<ENDPOINT>
Type="BULK"
Direction="IN"
Address="81h"
Attributes="02h"
MaxPktSize="1024"
DescriptorType="5"
DescriptorLength="7"
Interval="0"
<SUPER SPEED ENDPOINT COMPANION>
Type="SUPERSPEED_USB_ENDPOINT_COMPANION"
MaxBurst="0"
Attributes="00h"
BytesPerInterval="00h"
</ENDPOINT>
</INTERFACE>
<INTERFACE 0>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I finally figured it out. I used counters in DMA callbacks to register new transfers and in main loop just set LED on or off depending if we registered new transfers from previous cycle or not
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great.
Regards,
Sridhar