full duplex USB Audio (mic+speaker) on FRDM-kl46Z, howto?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

full duplex USB Audio (mic+speaker) on FRDM-kl46Z, howto?

跳至解决方案
3,261 次查看
dimitribecker
Contributor II

Hi all

 

I want to use the FRDM-KL46 Board as usb to I2S converter.

 

I've started with the audio generator example code and tried to change the descriptor.c to be both, speaker and mic

(see the code attached), no succes :-(

 

I'm on KDS 3.0  with ksdk 1.3

 

 

Best Regards

 

Dmitri Becker

Original Attachment has been moved to: usb_descriptor.c.zip

Original Attachment has been moved to: USB_Audio_fd.zip

标记 (2)
1 解答
2,087 次查看
isaacavila
NXP Employee
NXP Employee

Hello Dimitri,

  • ep structure specifies the characteristics for used endpoints in application, these characteristics include Endpoint number, Pipe Type, Endpoint direction and Maximum size for this endpoint.

  • ut is the structure that makes reference to audio topology (Input Terminals, Feature Unit, Mixer Unit, Output Terminals, etc) in order to identify how many units are presented in the device. These same units are described in descriptor as shown in previous file.

  • usb_if serves to identify the interfaces available in the device.

These structures are accesible when host requests a USB_Desc_Get_Entity request, so they are for information purposal.

I hope this can help you,

Best Regards,

Isaac

在原帖中查看解决方案

0 项奖励
回复
7 回复数
2,087 次查看
dimitribecker
Contributor II

I've changed the descriptor, so my device is now play/record device.

There is still an error message:

"too many audio endpoint for the class driver" on the serial.

I've initialized only 2 Endpoints (decriptor-file attached above)Please help me understand, what i've done wrong! 

Other question is:

Do I need to create separate task (and separate Callback function) for each read/write, or can it be done in one task?

Regards

0 项奖励
回复
2,087 次查看
isaacavila
NXP Employee
NXP Employee

Hello Dimitri,

What software are you using? (KSDK, MQX, USB Stack 4.1.1) and also, could you please attach your full project?

Best Regards,

Isaac

0 项奖励
回复
2,087 次查看
dimitribecker
Contributor II

Hi Isaac

I'm using ksdk 1.3, no mqx.

The audio generator example code for the FRDM-46z board

The project file is attached in the first post.

I have no idea regarding USB stack version, I simply use the version attached in the example project.

My problem is understanding, how to make the data structure of the usb-descriptor.c full duplex ready

Regards

Dimitri

0 项奖励
回复
2,087 次查看
isaacavila
NXP Employee
NXP Employee

Hello Dimitri,

There is a document that talks about different USB Audio topologies that are compliant with USB specifications. In this document you can find some examples in how to define your descriptor according to desired topology.

I recommend you to review this document and identify which topology you will be using.

Also, there is macro definition in usb_audio_config.h that limits endpoint usage to 1, so you should change this macro in order to add more endpoints to your application.

#define MAX_AUDIO_CLASS_EP_NUM          (0x01)

I hope this can help you,

Best Regards,

Isaac

0 项奖励
回复
2,087 次查看
dimitribecker
Contributor II

Hi Isaac.

Thank you, I'll change the define to 2.

I have no problems with USB descriptors, same descriptors are working with other platform.

BUT the data structure in the descriptor.c is quite confusing...

ep, ut, usb_if ... all this structs

Would like to know, how to change them according to my descriptor configuration.

0 项奖励
回复
2,088 次查看
isaacavila
NXP Employee
NXP Employee

Hello Dimitri,

  • ep structure specifies the characteristics for used endpoints in application, these characteristics include Endpoint number, Pipe Type, Endpoint direction and Maximum size for this endpoint.

  • ut is the structure that makes reference to audio topology (Input Terminals, Feature Unit, Mixer Unit, Output Terminals, etc) in order to identify how many units are presented in the device. These same units are described in descriptor as shown in previous file.

  • usb_if serves to identify the interfaces available in the device.

These structures are accesible when host requests a USB_Desc_Get_Entity request, so they are for information purposal.

I hope this can help you,

Best Regards,

Isaac

0 项奖励
回复
2,087 次查看
dimitribecker
Contributor II

Hi Isaac

This is what i don't understand.

All this things are already specified in the descriptor, The Host has the config descriptor with all needed information,

so why making it one more time ? :-)   What is the reason for this structures?

Ok, so I have 2 Endpoints (actually one but send and receive with same number), 3 interfaces and 5 audio units.

This code should be Ok, right?

****************************************************************************************************************************************************************************

usb_ep_struct_t ep[AUDIO_DESC_ENDPOINT_COUNT] =  // 2 two endpoints with same number

{

        {

        AUDIO_ENDPOINT,   // Endpoint Number

        USB_ISOCHRONOUS_PIPE,

        USB_SEND,

        FS_ISO_OUT_ENDP_PACKET_SIZE

        },

        {

        AUDIO_ENDPOINT,

        USB_ISOCHRONOUS_PIPE,

        USB_RECV,

        FS_ISO_OUT_ENDP_PACKET_SIZE

        }

};

usb_endpoints_t usb_desc_ep =

{

    (AUDIO_DESC_ENDPOINT_COUNT),

    ep

};

static usb_if_struct_t usb_if[3];

usb_class_struct_t usb_dec_class =

{

    USB_CLASS_AUDIO,

    {

        3,

        usb_if

    }

};

/* *********************************************************************

* definition a struct of Input/output or Feature Unit

************************************************************************ */

audio_ut_struct_t ut[AUDIO_UNIT_COUNT] =

{

    { 0x01, AUDIO_CONTROL_INPUT_TERMINAL },

    { 0x02, AUDIO_CONTROL_FEATURE_UNIT },

    { 0x03, AUDIO_CONTROL_OUTPUT_TERMINAL },

    { 0x04, AUDIO_CONTROL_INPUT_TERMINAL },

    { 0x05, AUDIO_CONTROL_OUTPUT_TERMINAL }//,

};

audio_units_struct_t usb_audio_unit =

{

    AUDIO_UNIT_COUNT,   // =5

    ut

};

0 项奖励
回复