Hi, I use Lab3 based USB firmware, but my application isn't supplyed from USB, it has its has it's own power source, so how to setup pic to don't use USB power source?
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 10, 2006 12:51:54 AM
Guest
quote:
ORIGINAL: kroySoft
Hi Brad,
I've figured out, how to use your code with the MC's bootloader. Actually it was a piece of cake. :D There is only one line to add and one to modify in the linker file, and the reset vector need to change from 0x0000 to 0x0800 in the assembly code. That's all! It works now fine.
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 12, 2006 7:20:46 PM
Guest
Hi Brad. I'm sorry I didn't remember that that information came in that document. I'll check it.
I have a doubt about the usb_defs.inc, as you know I'm not very good in the assembler structure and the mplab instruction neither, and I hope that you can help me. There are some lines like the followin...
What mean those lines? Which is the difference between both (with and without parenthesis )?
I read about the "<<" in the mplab help and it said that is a right shift, for me that mean that a bit in a byte rotate or move n locations to the right. e.g. #define TOKEN_OUT is (0x01<<2); then token_out become 0x04. Am I right?
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 15, 2006 3:01:55 PM
Guest
Hi Brad.
I have a question about the firmware. In the call ProcessSetupToken, there is a "ifl" instruction after save the USB_buffer_data(0...7) in the ram, and it makes the comparción between USB_buffer_data+bmRequestType and 0x21. That it represents 0x21? I tried to find in the usb especification and I didn't find it.
Hi to all I am trying to modify lab.1 assembly code in order to make interrupt out transfer via endpoint1.I managed to upgrade to full speed and successfully declare in descriptor the interrupt out endpoint 1. After that I setup Endpoint1 buffer descriptor in ServiceUSB routine under caseset UIR, URSTIF, ACCESS (I have doubts is the correct place?)
movwf BD0IAH, BANKED ; ...set up its address movlw 0x08 ; clear UOWN bit (MCU can write) movwf BD0IST, BANKED ********my code movlw MAX_PACKET_SIZE movwf BD1OBC, BANKED movlw low (USB_Buffer+2*MAX_PACKET_SIZE) ; EP1 OUT gets a buffer... movwf BD1OAL, BANKED movlw high (USB_Buffer+2*MAX_PACKET_SIZE) movwf BD1OAH, BANKED ; ...set up its address movlw 0x88 ; set UOWN bit (USB can write) movwf BD1OST, BANKED ********end of my code clrf UADDR, ACCESS ; set USB Address to 0 clrf UIR, ACCESS
….and then inserted the following in ProcessOutToken routine under case EP1 to turn on a test led
but instead, I am receiving from pc application the following error: Failed transferring 1 Bytes to Pipe01. Error (0xc0000005) - HC status: Device not responding. Transferred 0 Bytes to Pipe01
On the other hand control transfers are successful. Any suggestions?
OK here I am again I just solve the problem, I insert the enpoints buffer discriptors initalisation code under StandardRequests-->case SET_CONFIGURATION Nick
currently I haven't too much time, therefore I am very rarely here, I'm sorry. So I've seen, that you are interested in using the MC's bootloader with Brad's program code. Maybe you've solved this problem yet, but I will try to explain, how to do it... First of all, you need to use a modified linker (*.lkr) file for your MCU type, that looks like this:
// Sample linker command file for 18F4550 with Bootloader // on base of Rawin Rojvanit's work LIBPATH .
As you can see, there is three major changes according to the original file: the first line under the "LIBPATH ." expression was added, the beginning of CODEPAGE 'vector" was changed from 0x00h to 0x800h and CODEPAGE 'page' was changed from 0x2Ah to 0x82Ah. Any other linker files should modify like this one, if you want to use your program with the bootloader.
One other thing to do is to change the line in Brad's code: 'STARTUP code 0x0000' to this: 'STARTUP code 0x0800'
I hope, you can use this information, I give you joy of it. Thanks to Brad for his great work!
RE: PIC18F2455/4455 Assembler USB Firmware Available - May 29, 2006 12:35:51 AM
Guest
Hello
I've tried the assembler version of 'genhid' (for a 18F4455) but something didn't work: when I run the program, there is a windows information bubble saying that the device is not recognized. I've checked with the ICD2 in debugger mode to find where the problem might be and I found that the microcontroller never reached the 'caseset UIR, TRNIF, ACCESS' part of the program (in ServiceUSB) It would mean that the computer doesn't send anything to the usb, right? But then, why would a standard HID mouse work without any problem? Besides, the program does reach ' caseset UIR, URSTIF, ACCESS' (USB reset, right?) and execute the instructions following this caseset.
If you are getting a "Device not recognized" message from Windows, then it may very well be a problem with your circuit. Have you built your own circuit? If so, what did you base it on? All of the firmware that I have supplied assumes that you are using an external 4-MHz crystal and that you are using the internal pull-up resistors that are built into the PIC18F2455/4455/2550/4550 instead of an external one between VUSB (pin 14 on the '2455 and '2550) and D+ or D- (pins 15 and 16 on the '2455 and '2550). If you have an external pull-up resistor and you have not changed the firmware to disable the use of the internal ones, that could be the problem. Another common circuit problem resulting in the dreaded "Device not recognized" message bubble is that there is no 0.47-uF capacitor between VUSB and ground. (The datasheet stipulates at least 0.22-uF, but the PICDEM USB FS board that Microchip sells has a 0.47-uF cap.) I would recommend using a ceramic cap here. Also, you should have a decoupling capacitor of between 1 uF and 10 uF between VBUS (+5 V from the USB) and ground. I use a 10-uF tantalum cap in parallel with a 0.1-uF ceramic cap. Once you get the device to be recognized, you will probably notice that the first transfer does not work properly. This is a bone fide firmware bug that I have not addressed in the main event loop of my implementation of the genhid firmware. I will probably try to look at that again in the next week or so...
RE: PIC18F2455/4455 Assembler USB Firmware Available - May 29, 2006 10:25:27 PM
Guest
Oh, thank you for your reply, Brad Minch. I didn't do the hardware circuit board myself, but my internship tutor has just told me we're using a 6MHz cristal (it was a board previously used with a 16C765). the capacitor we use is the one on the schematics (220 nF) and I don't think I can change it. I hope it will do, but I don't know how to setup the USB properly with the 6 MHz clock.
Anyway, thanks again for your reply (I'll edit if I can make it work.)
As I know, the new PIC's USB function doesn't work with 6 MHz clock frequency. Please take a look at the PIC18F2x5x/4x5x data sheet. The input clock frequency must be divisible by 4.
I have used a PCB originally intended for a 16CXXX pic with a 18F2455 - I had to change the crystal to 4MHz - The USB smoothing capacitor was/is fine but check for a pull up resistor on D+ D- and remove it because Brad's code uses the on chip resistors.
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 6, 2006 10:53:43 PM
Guest
Thank you for all this help! THe oscillator was indeed what was messing it all uo
I can now have my microcontroller working at full speed and send 64 bytes each time. Since I'm using an HID descriptor/driver, I can only send data 60 times per second. The rpoblem is that I need to send about 10 kB per second and I'm only sending 3800 bytes/s that way. Is there a mean to make things go faster? The HID can only send data 60 times per second, but can I triple this by using 3 endpoints and rotating between them?
Posts: 32
Joined: May 31, 2006
From: 0
Status: offline
hello, im very new in this field and im working on my final year project on lamp testing.1st, what is exactly VREGEN in configuration bit does?i tried to browse through microchip web but couldn't find any. 2nd, in the program proposed by Mr. Minch, why is the config BORV is 21?i tried to program lab1 and lab4 on my PIC18F2455 proposed by Mr. Minch, but my PC kept on hanging whenever i connect the USB port at my PCB to the PC. but there was once buble "Device not recognized" appeared, other than that, it hangs. ive browsed through this forum and i think i do have to replace 1 of my cap form Vusb to ground but why does my PC hangs instead of popping "Device not recognized"?
I thought full speed only allowed for 64 bytes buffers to be sent? IS there a mean to send more through a HID- configured 18F4455?
That's 64 byte buffers, not 64 byte HID reports. Depending on the host driver, a HID report can be up to 64k bits. However depending on the firmware you started with, you may need to do some work to make it send a multiple packet report.
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 4:58:59 AM
Guest
Are you sure that a HID class device (18F4455) used to communicate with a PC with standard windows HID drivers and APIs can send data every millisecond? My internship tutor told me that HID (or at least windows' standard HID drivers) was 60 data transfers per second...
Edit: Pacer, how can you transfer more than 64 bytes of data? Can you send multiple buffers at once? And the total USB RAM available on a 18F4455 is a lot less than 64kB, so how do you do that?
< Message edited by Werewindle -- Jun. 7, 2006 5:15:00 AM >