Microchip Technology
Welcome to www.microchip.com
Search: Click here to Search Microchip.com
Forums Home Register LoginLog Out Inbox Address Book My Subscription Member List Search My Profile FAQ
RE: PIC18F2455/4455 Assembler USB Firmware Available

RE: PIC18F2455/4455 Assembler USB Firmware Available

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Microcontroller Discussion Group] >> USB >> RE: PIC18F2455/4455 Assembler USB Firmware Available Page: <<   < prev  12 13 [14] 15 16   next >   >>
Login
Message << Older Topic   Newer Topic >>
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 9, 2006 6:32:46 AM   
P@t

 

Posts: 5
Joined: Nov. 6, 2005
Status: offline
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?

(in reply to Guest)
Post #: 261
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.

Best Regards,

Kroy Smith


Sounds interresting, can I get some more details?

(in reply to kroySoft)
  Post #: 262
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...


#define TOKEN_OUT (0x01<<2)
#define TOKEN_ACK (0x02<<2)
#define TOKEN_IN (0x09<<2)
#define TOKEN_SETUP (0x0D<<2)

and there are some like the next lines...

#define SVCUSBINT  0x01 << 2
#define SVCTOKENDONE  0x02 << 2
#define SVCRESET  0x03 << 2
#define SVCSLEEP  0x04 << 2
#define SVCSTALL  0x05 << 2
#define SVCERROR  0x06 << 2

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?

Regards.
Thank you for the reply.

gelalo

(in reply to bminch)
  Post #: 263
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.

Thank you.
Regards.

gelalo

(in reply to Guest)
  Post #: 264
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 15, 2006 3:12:44 PM   
NICK7

 

Posts: 29
Joined: Apr. 15, 2006
From: 0
Status: offline
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

movlw              NO_REQUEST
movwf              USB_dev_req, BANKED        ; clear device request
BTG                 PORTB,1,ACCESS
banksel BD1OBC
movlw              0x08
movwf              BD1OBC, BANKED
movlw              0x88
movwf              BD1OST, BANKED

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?

Thanks nick

(in reply to Guest)
Post #: 265
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 16, 2006 12:09:52 PM   
NICK7

 

Posts: 29
Joined: Apr. 15, 2006
From: 0
Status: offline
OK here I am again
I just solve the problem, I insert the enpoints buffer discriptors initalisation code under StandardRequests-->case SET_CONFIGURATION
Nick 

(in reply to NICK7)
Post #: 266
RE: PIC18F2455/4455 Assembler USB Firmware Available - Apr. 26, 2006 1:56:43 AM   
kroySoft

 

Posts: 21
Joined: Feb. 10, 2006
From: 0
Status: offline
Hi PHermansson,

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 .
 
CODEPAGE   NAME=boot       START=0x0            END=0x7FF          PROTECTED
CODEPAGE   NAME=vectors    START=0x800          END=0x0x829        PROTECTED
CODEPAGE   NAME=page       START=0x82A          END=0x7FFF
CODEPAGE   NAME=idlocs     START=0x200000       END=0x200007       PROTECTED
CODEPAGE   NAME=config     START=0x300000       END=0x30000D       PROTECTED
CODEPAGE   NAME=devid      START=0x3FFFFE       END=0x3FFFFF       PROTECTED
CODEPAGE   NAME=eedata     START=0xF00000       END=0xF000FF       PROTECTED

 
ACCESSBANK NAME=accessram  START=0x0            END=0x5F
DATABANK   NAME=gpr0       START=0x60           END=0xFF
DATABANK   NAME=gpr1       START=0x100          END=0x1FF
DATABANK   NAME=gpr2       START=0x200          END=0x2FF
DATABANK   NAME=gpr3       START=0x300          END=0x3FF
DATABANK   NAME=usb4       START=0x400          END=0x4FF          PROTECTED
DATABANK   NAME=usb5       START=0x500          END=0x5FF          PROTECTED
DATABANK   NAME=usb6       START=0x600          END=0x6FF          PROTECTED
DATABANK   NAME=usb7       START=0x700          END=0x7FF          PROTECTED
ACCESSBANK NAME=accesssfr  START=0xF60          END=0xFFF          PROTECTED

SECTION    NAME=CONFIG     ROM=config
 
STACK SIZE=0x100 RAM=gpr3

 
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!
 
kroy

(in reply to Guest)
Post #: 267
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.

Can someone help me please?

(in reply to kroySoft)
  Post #: 268
RE: PIC18F2455/4455 Assembler USB Firmware Available - May 29, 2006 6:42:52 AM   
bminch

 

Posts: 160
Joined: Apr. 21, 2005
Status: offline
Hi Werewindle,

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...

Brad Minch.

(in reply to Guest)
Post #: 269
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.)

(in reply to bminch)
  Post #: 270
RE: PIC18F2455/4455 Assembler USB Firmware Available - May 29, 2006 10:48:33 PM   
kroySoft

 

Posts: 21
Joined: Feb. 10, 2006
From: 0
Status: offline
Hi Werewindle,

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.

Regards,

kroy

(in reply to Guest)
Post #: 271
RE: PIC18F2455/4455 Assembler USB Firmware Available - May 30, 2006 12:49:04 AM   
jeff_m_lee

 

Posts: 442
Joined: Jun. 8, 2005
Status: offline
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.

(in reply to Guest)
Post #: 272
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?

(in reply to jeff_m_lee)
  Post #: 273
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 12:25:33 AM   
Pacer

 

Posts: 991
Joined: Dec. 1, 2004
Status: offline
Why not send more bytes each time?

_____________________________

USB Made Simple!

Range of USB Bus Analysers

(in reply to Guest)
Post #: 274
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 12:36:46 AM   
Guest
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?

(in reply to Pacer)
  Post #: 275
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 1:53:47 AM   
hairiah

 

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"?

(in reply to bminch)
Post #: 276
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 2:16:37 AM   
jeff_m_lee

 

Posts: 442
Joined: Jun. 8, 2005
Status: offline
quote:

I can only send data 60 times per second.


Why ? - even with 1 endpoint you should be able to make a transfer every frame = 1000 times a second

quote:

but can I triple this by using 3 endpoints and rotating between them?   


Yes - you should be able to transfer 3x64x1000 = 192KBytes/s that way.


(in reply to Guest)
Post #: 277
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 4:56:18 AM   
Pacer

 

Posts: 991
Joined: Dec. 1, 2004
Status: offline
quote:

ORIGINAL: Werewindle

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.

_____________________________

USB Made Simple!

Range of USB Bus Analysers

(in reply to Guest)
Post #: 278
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 >

(in reply to Pacer)
  Post #: 279
RE: PIC18F2455/4455 Assembler USB Firmware Available - Jun. 7, 2006 6:59:55 AM   
Pacer

 

Posts: 991
Joined: Dec. 1, 2004
Status: offline
quote:

Pacer, how can you transfer more than 64 bytes of data? Can you send multiple buffers at once?

Well, actually one after another.

quote:

And the total USB RAM available on a 18F4455 is a lot less than 64kB, so how do you do that?

I was talking about HID limitations, not PIC limitations. But you just aren't limited to sending one packet per report.

_____________________________

USB Made Simple!

Range of USB Bus Analysers

(in reply to Guest)
Post #: 280
Page:   <<   < prev  12 13 [14] 15 16   next >   >>
All Forums >> [Microcontroller Discussion Group] >> USB >> RE: PIC18F2455/4455 Assembler USB Firmware Available Page: <<   < prev  12 13 [14] 15 16   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


  Site Index  |  Legal Information  |  microchipDIRECT  |  Samples  |  Technical Support  |  Investor Information  |  Careers at Microchip  |  Contact Us  |  RSS Feeds ©2009 Microchip Technology Inc.  
  Shanghai ICP Recordal No.09049794  
Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

1.312