I have one MCB2300,the demo "USBUVC",how can I add a jpg file for test? thank you,very much.
> how can I add a jpg file for test?
Are you burning the (M)JPG file into LPC2368 FLASH?
Over ULINK2, "Load binary files with ulink2" http://www.keil.com/forum/docs/thread15857.asp
"Program Objects" http://www.keil.com/support/man/docs/uv4/uv4_fl_programobj.htm
OR
Over COM port - ISP www.nxp.com/.../AN10302.pdf
AN10302: Using the Philips LPC2000 Flash utility with the Keil MCB2100 and IAR LPC210x Kickstart evaluation boards www.nxp.com/.../AN10302.pdf
LPC2000 FLASH utility www.nxp.com/.../
To embed it into a code array, many utilities is floating over the net, for example, "bin2hex - script to convert data files into source code arrays" www.chami.com/.../052098D.html
Tsuneo
Thanks for your reply, I use ulink2 download to lpc2368 with MDK4.01. When I run the UVC demo,It can create a desktop video cameras device. But no any video streaming,so I need added the video data, a jpg file , to test as MJPG. The demo: developerarm7.googlecode.com/.../USB_UVC_LPC
It can checkout with SVN,windows XP OS: developerarm7.googlecode.com/.../trunk
> I use ulink2 download to lpc2368 with MDK4.01
Convert the MJPEG file into HEX file, using this Keil utility. The load address is specified with the option (/On)
BINARY to Intel HEX Converter Utility http://www.keil.com/download/docs/113.asp
The HEX file is downloaded into the FLASH by adding "LOAD MJPEG.HEX" command to the init script.
Pre-Download Scripts http://www.keil.com/support/man/docs/uv4/uv4_fl_predownload.htm
You may make a new uVision project just for writing the HEX file into the FLASH.
HEX Files http://www.keil.com/support/man/docs/uv4/uv4_fl_hexdownload.htm
In this case, tune the original project so as not to erase the entire Flash.
Project â€" Options â€" Utilities - settings
I write a tool convert the *.jpg file to *.h developerarm7.googlecode.com/.../Tools
My problem is: I cannot realy understand the USB Video Class, so I cannot add any code to the demo. The UVC is difficult to me.
Thank you,:)
> It can checkout with SVN,windows XP OS:
Seems just fit the NXP LPC2888 USBUVC example to LPC2368 :-) The example doesn't implement any process for the streaming isoc endpoint.
Sample Code Bundle for LPC288x Peripherals, V1.30 (Sep 5, 2007) www.standardics.nxp.com/.../code.bundle.lpc288x.zip
For LPC2368, isoc EP is driven in SOF (FRAME) interrupt, or DMA.
As the example has already enabled USB_SOF_EVENT in usbcfg.h, fill in USB_SOF_Event() with your transfer process.
usbuser.c #if USB_SOF_EVENT void USB_SOF_Event (void) { } #endif
The video packets are passed to the isoc EP3, using USB_WriteEP(), one by one on each USB_SOF_Event() call. The packet format is defined in the UVC spec,
USB_Video_Payload_MJPEG_1.1.pdf
included in "Video Class 1.1 document set" www.usb.org/.../USB_Video_Class_1_1.zip
> My problem is: I cannot realy understand the USB Video Class, so I cannot add any code to the demo. The UVC is difficult to me.
Your problem is that you don't write your problem clearly :-)
Surely, in most cases, if you could exactly specify what the problem is, the problem would be solved more than half. Then, take effort to explain your problem more clearly. It'll accelerate your progress effectively. In this way, we've become the learnt.
Thank you ! I will try it.
English is not my mother language,I'm a Chinese. Thank you.:)
1. I added the jpg data to the demo:
#ifndef _JPG_GLOBAL_ extern const unsigned int JPG_size; extern const unsigned char JPG_data[]; #else const unsigned int JPG_size = 0x2c5a; const unsigned char JPG_data[] = { 0xff,0xd8,0xff,0xe0,0x00,0x10 ..... ..... 0xfd,0x7f,0x4c,0xff,0xd9 };
2. transfer process
volatile DWORD TestCnt; volatile DWORD JPG_Cnt; #define EP3_MAX_PACKET 0x1FE #if USB_SOF_EVENT void USB_SOF_Event (void) { TestCnt++; if((JPG_size - JPG_Cnt) > EP3_MAX_PACKET) { USB_WriteEP(0x83,(BYTE *)(JPG_data + JPG_Cnt),EP3_MAX_PACKET); JPG_Cnt += EP3_MAX_PACKET; } else { USB_WriteEP(0x83,(BYTE *)(JPG_data + JPG_Cnt),JPG_size - JPG_Cnt); JPG_Cnt = 0; } } #endif
The data transfer to the host, I can see it with a usb tool - USBTrace. But the jpg can't display on the PC. Maybe need do something else.
I use two bytes for Payload Header Field,but fail too.
#if USB_SOF_EVENT void USB_SOF_Event (void) { /* Payload header - SOF_Event_Buf[0~1] */ if(JPG_Cnt == 0) /* Start of Frame */ { SOF_Event_Buf[0] = 0x02; SOF_Event_Buf[1] &= 0x01; } else { SOF_Event_Buf[1] ^= 0x01; /* FID */ /* The last packet of jpg */ if((JPG_size - JPG_Cnt) <= (EP3_MAX_PACKET - 2)) SOF_Event_Buf[1] |= 0x02; /* EOF - End of Frame */ } /* Copy data and send */ Write_To_Buf(); USB_WriteEP(0x83,(BYTE *)SOF_Event_Buf,Buf_Size); } #endif
Fixed but fail too.
#if USB_SOF_EVENT void USB_SOF_Event (void) { /* Payload header - SOF_Event_Buf[0~1] */ if(JPG_Cnt == 0) /* Start of Frame */ { SOF_Event_Buf[0] = 0x02; SOF_Event_Buf[1] &= 0x01; SOF_Event_Buf[1] ^= 0x01; /* FID */ SOF_Event_Buf[1] |= 0x80; /* EOH */ } else { /* The last packet of jpg */ if((JPG_size - JPG_Cnt) <= (EP3_MAX_PACKET - 2)) SOF_Event_Buf[1] |= 0x02; /* EOF - End of Frame */ } /* Copy data and send */ Write_To_Buf(); USB_WriteEP(0x83,(BYTE *)SOF_Event_Buf,Buf_Size); } #endif
Hi,Tsuneo
I modify the payload header,and it's work!
Thank you !
Xu