Trying to Run USB Audio Example Code On FRDM-KL25Z

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

Trying to Run USB Audio Example Code On FRDM-KL25Z

2,033 Views
marktrainer
Contributor I

Trying to run USB audio example code on the KL25Z freedom board, once I get a working project then it is easier to understand the mechanisms and customize it for my project's needs.

I am using CW10.6 and Freescale USB Stack v4.0.3. I can compile and download the USB_AUDIO_DEVICE_MKL25Z128_PEx demo; albeit a huge (and uncomfortable) list of warnings from pragma's and  unused variables. (see below) This is "out of the box" unhampered project.

But upon connecting to the PC, the PC does not recognize the USB peripheral. I receive "USB Device Not Recognized", if I open the device status pane it reads "Windows has stopped this device because it has reported problems. (Code 43)"

I have similar difficulties with all the USB demos for the KL25 and K20 board projects (USB audio and CDC). Is there something silly that I am doing on my end?

In file included from ../Sources/USB/app/audio_generator/audio_generator.c:23:0:

C:/Freescale/Freescale USB Stack v4.0.3/ProcessorExpert/Examples/Device/Audio/USB_AUDIO_DEVICE_MKL25Z128_PEx/Sources/USB/app/common/kinetis/hidef.h:20:0: warning: ignoring #pragma gcc_extensions on [-Wunknown-pragmas]
C:/Freescale/Freescale USB Stack v4.0.3/ProcessorExpert/Examples/Device/Audio/USB_AUDIO_DEVICE_MKL25Z128_PEx/Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Sources/USB/app/audio_generator/audio_generator.c: In function 'TestApp_Init':

../Sources/USB/app/audio_generator/audio_generator.c:120:14: warning: variable 'error' set but not used [-Wunused-but-set-variable]

../Sources/ProcessorExpert.c:38:6: warning: return type of 'main' is not 'int' [-Wmain]

../Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Generated_Code/usb_audio.c: In function 'USB_Service_Audio_Status_Interrupt':

../Generated_Code/usb_audio.c:93:12: warning: variable 'producer' set but not used [-Wunused-but-set-variable]

../Generated_Code/usb_audio.c: In function 'USB_Service_Audio_Isochronous_IN':

../Generated_Code/usb_audio.c:161:21: warning: variable 'iso_in_recv' set but not used [-Wunused-but-set-variable]

../Generated_Code/usb_audio.c:160:12: warning: variable 'producer' set but not used [-Wunused-but-set-variable]

../Generated_Code/usb_audio.c: In function 'USB_Audio_Get_Feature_Unit':

../Generated_Code/usb_audio.c:784:12: warning: variable 'status' set but not used [-Wunused-but-set-variable]

../Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Generated_Code/usb_class.c:31:13: warning: 'USB_Device_Init_Params' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:32:13: warning: 'USB_Control_Service' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:33:13: warning: 'USB_Control_Service_Handler' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:34:15: warning: 'USB_Strd_Req_Get_Status' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:35:15: warning: 'USB_Strd_Req_Feature' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:36:15: warning: 'USB_Strd_Req_Set_Address' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:37:15: warning: 'USB_Strd_Req_Get_Config' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:38:15: warning: 'USB_Strd_Req_Set_Config' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:39:15: warning: 'USB_Strd_Req_Get_Interface' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:40:15: warning: 'USB_Strd_Req_Set_Interface' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:41:15: warning: 'USB_Strd_Req_Sync_Frame' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:42:15: warning: 'USB_Strd_Req_Get_Descriptor' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:43:13: warning: 'USB_DCI_CallBack' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:44:13: warning: 'USB_DCI_SetAddressCallback' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:45:15: warning: 'USB_DCI_Get_BDT_Index' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_class.c:46:15: warning: 'USB_DCI_Validate_Param' declared 'static' but never defined [-Wunused-function]

../Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Generated_Code/usb_dci.c: In function 'USB_DCI_SetAddressCallback':

../Generated_Code/usb_dci.c:86:44: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

../Generated_Code/usb_dci.c: In function 'USB_DCI_OnDeviceSetupPacket':

../Generated_Code/usb_dci.c:257:53: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

../Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Generated_Code/usb_descriptor.c: In function 'USB_Desc_Set_Cur_Volume':

../Generated_Code/usb_descriptor.c:851:12: warning: variable 'volume' set but not used [-Wunused-but-set-variable]

../Generated_Code/usb_devapi.h:216:0: warning: ignoring #pragma options align [-Wunknown-pragmas]

../Generated_Code/usb_framework.c:42:3: warning: missing braces around initializer [-Wmissing-braces]

0 Kudos
Reply
2 Replies

1,253 Views
BlackNight
NXP Employee
NXP Employee

Are you really using the 4.0.3 stack? The latest released one is V4.1.1 and is what I would suggest.

Actually depending on the compiler (GNU ARM as it seems?), these alignment warnings are a real problem in my view.

I have used the 4.1.1. stack and ported/fixed some of these, and published as Processor Expert components/projects.

I have done USB CDC, HID (KBD and MOUSE) plus MSD, but not audio.

I have attached for you a project (USB CDC for FRDM-KL25Z) you could use or compare.

The project includes all sources, plus an S19 file so you can load it with the FRDM bootloader (no need to compile things).

Other examples are on GitHub (but most require extra Processor Expert components, see Processor Expert Component *.PEupd Files on GitHub | MCU on Eclipse).

Description is on http://mcuoneclipse.wordpress.com/2012/09/30/tutorial-usb-cdc-with-the-kl25z-freedom-board/

Other projects are on GitHub: mcuoneclipse/Examples at master · GitHub

1,253 Views
marktrainer
Contributor I

Thanks for getting back. I am using all "defaults" in the IDE.

I d/l the Freescale USB Stack v4.1.1 stack and installed it. I am using the project in the following folder:
C:\Freescale\Freescale USB Stack v4.1.1\Source\Device\app\audio_generator\cw10\kinetis_k20\.project

is not straight forward on the freedom board (FRDM-K20D50M).

When I run & debug, I had to make a new connection for OpenSDA. In that I had to select a checkbox (for the first time in my memory) titled "Use SWD reduced pin protocol for communications" just to get it to connect to the board.

Based on Eli's KL25 tutorial, I needed to change the high gain HGO0 in MCG_C2 register in order to keep the system from hanging on the pll_init() function.

Now it seems to hand on the following line number
2364: while (!(MCG_S & MCG_S_OSCINIT0_MASK)){};

I finally resorted to porting over the mcg.c and mcg.h files into the project. now I can get it to work, but for some reason I cannot get a connection for debug now on this project using OpenSDA (freedom board) - I can share those errors if interested. I now resort to the flash tool to download the binary.

The USB enumerated and the demo works. I like the Monty Python blurb!

I briefly tried the CDC demo, but I think it requires the PE files referenced on MCUonEclipse (github) to get it to work since I got some strange erros. I'll take a look at that next.

0 Kudos
Reply