Hi,
i have added a HID Endpoint to the USB Audio program.
The problem is now that every time i send Data to the PC the Audiostream is stopped for some ms. What can i do?
USB Audio problem with a new HID Endpoint
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
Hi,
is really nobody here how know, how i can send Data from a Endpoint to the PC, without the trouble in the Audio Stream?
is really nobody here how know, how i can send Data from a Endpoint to the PC, without the trouble in the Audio Stream?
-
- Experienced Member
- Posts: 69
- Joined: Sat Apr 30, 2011 6:19 pm
Hi Dirk,
I am by far not a specialist, but this sounds to me that you are running to much in one thread?
I believe you need to show us a little more information how and were you have added the HID that we have a chance to help.
See you around
Frank
I am by far not a specialist, but this sounds to me that you are running to much in one thread?
I believe you need to show us a little more information how and were you have added the HID that we have a chance to help.
See you around
Frank
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
I hope this will help.
Dirk
Dirk
Code: Select all
---- main.xc
on stdcore[0] :in port p_HID0 = XS1_PORT_1K; // HID Port
void decouple(chanend, chanend?, chanend?, chanend?);
/* Endpoint type tables for XUD */
XUD_EpType epTypeTableOut[NUM_EP_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EPTYPE_ISO,
XUD_EPTYPE_BUL };
XUD_EpType epTypeTableIn[NUM_EP_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EPTYPE_ISO,
XUD_EPTYPE_ISO,
XUD_EPTYPE_BUL,
XUD_EPTYPE_BUL
//#if (USB_HID)
,XUD_EPTYPE_INT
//#endif
};
par
{
thread_speed();
decouple(c_mix_out,
null, // MIDI
#if (USB_HID)
c_xud_in[5],
#else
null,
#endif
null);
}
---- endpoint0.xc
char reportBuffer[] = {0, 0, 0, 0};
---- decouple.xc
extern in port p_HID0;
extern char reportBuffer[];
void decouple(chanend c_mix_out,
chanend ?c_midi,chanend ?chan_ep1, chanend ?c_clk_int)
{
unsigned HID_Input_A;
unsigned HID_Input_Backup = 0;
int HID_Port_Val;
XUD_ep c_ep1 = XUD_Init_Ep(chan_ep1);
HID_Input_Backup = 0x00;
while(1)
{
if (!isnull(c_clk_int)) { check_for_interrupt(c_clk_int); }
asm("#decouple-default");
#ifdef DFU
if (!DFU_mode_active)
#endif
{
HID_Input_A = 0;
p_HID0 :> HID_Port_Val;
if (HID_Port_Val)
{
HID_Input_A = 1;
}
if (ID_Input_A && (ID_Input_A != HID_Input_Backup))
{
reportBuffer[0] = 0x01;
if (XUD_SetBuffer(c_ep1, reportBuffer, 1) < 0)
{
XUD_ResetEndpoint(c_ep1, null);
}
}
HID_Input_Backup = ID_Input_A;
}
-
- Experienced Member
- Posts: 69
- Joined: Sat Apr 30, 2011 6:19 pm
Hi Dirk,
as I said I am not the specialist, but maybe we can figure together:
Do I understand correct that you want to use the HID as audio Input?
I guess that DFU is undefined!?
What I see here is you are not sending Data to the PC but receiving from the PC!?
Assuming that the processing part gets done in asm("#decouple-default") I believe doing the HID processing in series must lead to interruptions.
See you around
Frank
as I said I am not the specialist, but maybe we can figure together:
Do I understand correct that you want to use the HID as audio Input?
I guess that DFU is undefined!?
What I see here is you are not sending Data to the PC but receiving from the PC!?
Assuming that the processing part gets done in asm("#decouple-default") I believe doing the HID processing in series must lead to interruptions.
See you around
Frank
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
Hi,
i have add (build) a new Endpoint (HID).
The PC Device handling is working without any problem.
I have now: Endpoint0, AUDIO in/out Endpoint and my HID Endpoint.
DFU is not defined!
In decouple, inside the while (1) part, i'm sending data to the PC.
My data sending is working, the PC is doing what i want.
I send a HID message to the PC just every second.
My problem is that every time i send my HID-data the Audio Stream stops for a while.
i have add (build) a new Endpoint (HID).
The PC Device handling is working without any problem.
I have now: Endpoint0, AUDIO in/out Endpoint and my HID Endpoint.
DFU is not defined!
In decouple, inside the while (1) part, i'm sending data to the PC.
My data sending is working, the PC is doing what i want.
I send a HID message to the PC just every second.
My problem is that every time i send my HID-data the Audio Stream stops for a while.
-
- Experienced Member
- Posts: 69
- Joined: Sat Apr 30, 2011 6:19 pm
Hi Dirk,
I believe the problem is that you do the HID communication in the very same thread where you do the audio stream.
One of the issues might be:
were the program is waiting until HID_Port_Val arrived.
can you segregate the HID communication into a separate thread?
Sorry if I can't give a direct solution. I am still learning how to use XMOS.
I believe the problem is that you do the HID communication in the very same thread where you do the audio stream.
One of the issues might be:
Code: Select all
p_HID0 :> HID_Port_Val;
can you segregate the HID communication into a separate thread?
Sorry if I can't give a direct solution. I am still learning how to use XMOS.
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
I will check this with the Task in 1 Week (holiday with internet).
The "p_HID0 :> HID_Port_Val;" instruction isn't waiting!
The sending of my MSG is blocking the Audio stream.
The Code is running without the sending stuff.
Dirk
The "p_HID0 :> HID_Port_Val;" instruction isn't waiting!
The sending of my MSG is blocking the Audio stream.
The Code is running without the sending stuff.
Dirk
-
- Experienced Member
- Posts: 69
- Joined: Sat Apr 30, 2011 6:19 pm
Hi Dirk,
sorry I used the wrong wording. (here it comes that english is not my native language.
What I wanted to say was more like:
In example code like this might cause.... ;-)
Sorry for that.
See you around
Frank
sorry I used the wrong wording. (here it comes that english is not my native language.
What I wanted to say was more like:
In example code like this might cause.... ;-)
Sorry for that.
See you around
Frank
-
- Active Member
- Posts: 32
- Joined: Fri Oct 07, 2011 3:20 pm
Hi Frank,
i found my mistake.
The hole system of sending Data is not easy inside the Audio project.
Why? I can't tell you and those how know why and why my code was wrong, didn't answer.
i found my mistake.
The hole system of sending Data is not easy inside the Audio project.
Why? I can't tell you and those how know why and why my code was wrong, didn't answer.