RT1020 UAC2 example Sample Rate issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1020 UAC2 example Sample Rate issue

Jump to solution
537 Views
Escalator2023
Contributor I

I am starting with Usb audio UAC2 on a RT1021 dev. board with "evkmimxrt1020_dev_composite_hid_audio_unified_freertos" example.

I managed to change the bit resolution to 24 bit or 32 bit instead of 16 bit default and I modified in "usb_device_descriptor.h" line to #define AUDIO_IN_SAMPLING_RATE_KHZ (96) to have 96000Hz sample rate but when I run the example my Linux still detects the dev board as a 48Khz sample rate one.

This happens only when I compile with #define USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 (1U) in "usb-device_config.h" header, instead, if I use #define USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 (0U) it shows correct 96000Hz sample rate.

There is a way to correct this when #define USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 (1U)  changing any usb descriptor field when the board is an UAC2 device?

Using alsacap in Linux:

With #define USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 (1U):

Card 3, ID `DEMO', name `USB AUDIO+HID DEMO'
Device 0, ID `USB Audio', name `USB Audio', 1 subdevices (1 available)
2 channels, sampling rate 48000..48000 Hz
Sample formats: S24_3LE
Subdevice 0, name `subdevice #0'

 

With #define USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 (0U):

Card 3, ID `DEMO', name `USB AUDIO+HID DEMO'
Device 0, ID `USB Audio', name `USB Audio', 1 subdevices (1 available)
2 channels, sampling rate 96000..96000 Hz
Sample formats: S24_3LE
Subdevice 0, name `subdevice #0'

Jose.

Labels (1)
0 Kudos
1 Solution
455 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi @Escalator2023,

 

In order to change the frequency with UAC2.0 you will need to modify these values as well in USB_DeviceAudioCompositeInit(). I just tried it and it is working on my side.

DanielRuvalcaba_0-1700592782047.png

 

Please try it and tell me if it works for you.

 

Regards,

Daniel.

View solution in original post

0 Kudos
3 Replies
446 Views
Escalator2023
Contributor I

Yes, sample rate change works, thanks Daniel.

I only confirmed it with 16 bit stereo and different sample rates because with more bit resolution (like 24 or 32 bit) Linux cannot give me back the correct format when I plug it  so I will check in a Windows computer to see if I need to change anything more for higher resolution work.

My target is 24/32 bit stereo at 96Khz. I modified these lines:

/* Audio data format */

#define AUDIO_OUT_FORMAT_CHANNELS (0x02U)

#define AUDIO_OUT_FORMAT_BITS (24)

#define AUDIO_OUT_FORMAT_SIZE (0x03)

#define AUDIO_IN_FORMAT_CHANNELS (0x02U)

#define AUDIO_IN_FORMAT_BITS (24)

#define AUDIO_IN_FORMAT_SIZE (0x03)

 

0 Kudos
502 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

 

I’m already taking a look into this. Please give me some time to get deeper in this.

 

Regard,

Daniel.

456 Views
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi @Escalator2023,

 

In order to change the frequency with UAC2.0 you will need to modify these values as well in USB_DeviceAudioCompositeInit(). I just tried it and it is working on my side.

DanielRuvalcaba_0-1700592782047.png

 

Please try it and tell me if it works for you.

 

Regards,

Daniel.

0 Kudos