USB DMA Read Endian Select

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

USB DMA Read Endian Select

Jump to solution
1,032 Views
amwilhite
Contributor III

Operating in USB Host Mode, I'm using the USB Audio class to read 16-bit, 16kHz PCM audio from a connected microphone.

The algorithm that processes the audio requires that the samples be in big-endian format; however, it appears that all USB data is transferred in little-endian.

I noticed that the USB Device Mode has an Endian Select field to switch between the two types, but I have not been able to find any mechanism for converting from little-endian to big-endian when reading USB audio in host mode.

Can anyone suggest a mechanism to accomplish this?

Labels (1)
0 Kudos
1 Solution
926 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked the USB OS Adapter has the ENDIANNESS definition at <usb_osa.h>:

/*! @brief Define big endian */
#define USB_BIG_ENDIAN (0U)
/*! @brief Define little endian */
#define USB_LITTLE_ENDIAN (1U)

/*! @brief Define current endian */
#define ENDIANNESS USB_LITTLE_ENDIAN

The OS adapter (OSA) is used to wrap the differences between RTOSes and enable a USB stack with the
same code base and behavior.

Note
OSA should not be used in the USB application. Therefore, from the USB application viewpoint, OSA is invisible.

If your application doesn't use RTOS, it need to software convert data from little endian to big endian.

best regards,

Mike

View solution in original post

0 Kudos
1 Reply
927 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked the USB OS Adapter has the ENDIANNESS definition at <usb_osa.h>:

/*! @brief Define big endian */
#define USB_BIG_ENDIAN (0U)
/*! @brief Define little endian */
#define USB_LITTLE_ENDIAN (1U)

/*! @brief Define current endian */
#define ENDIANNESS USB_LITTLE_ENDIAN

The OS adapter (OSA) is used to wrap the differences between RTOSes and enable a USB stack with the
same code base and behavior.

Note
OSA should not be used in the USB application. Therefore, from the USB application viewpoint, OSA is invisible.

If your application doesn't use RTOS, it need to software convert data from little endian to big endian.

best regards,

Mike

0 Kudos