USB Interfacing with GNU/Linux and PIC 18F2455 - Part 2


It's no wonder that there are so few complete resources on writing USB firmware on the net - there is only one word to describe the process - `tedious'. The last few days have been spent reading USB Complete - this is the only good book available to help you get along ... it's extremely well written. This book, combined with the code ofPUF framework seems to be the best combination for getting started. Another great resource is the code written by Bradley A Minch available from here. I prefer the PUF code because it's better structured - but there seems to be some trouble with the configuration bit definition in it. Our development environment is now stable. The programmer, `odyssey', is working perfectly and SDCC + gputils seems to be generating correct code. Unfortunately, we were unable to get PUF running on our 18F2455. So we began taking out bits and pieces of code from PUF and started testing them independently. We were able to go as far as initializing endpoint 0 and getting an OUT transaction on it. Now the trouble with USB is that it has a tricky state machine - the way you handle the current transaction depends on what the previous transaction was. You will soon reach a point where you won't be able to test things with 10-20 lines of code - you will have to have the whole state machine running smoothly. So yesterday, Anish `cleaned up' the PUF code taking out a lot of things which were not going to be useful for us at present but keeping the core intact. And, magically, everything started working. Enumeration was succesful and we have endpoint 0 ready to accept control transfter requests! Understanding Microchip's description of the working of their USB SIE (Serial Interface Engine) is another headache. Now we have to get some `vendor' requests working and maybe configure another endpoint to do interrupt transfer. I will think of writing a proper tutorial after that.


Fri Nov 7 09:22:28 2008

Hi, I'm trying to transfer my hex files to my PIC 18F4550 with the PIC USB Framework but I'm not able to. I did all the things that Vasco said on his help files. My device is recognized by Linux, so this isn't the problem... I don't know how to solve this situation, so if you could help me, please send me a mail. Thank you in advance, Pedro

[Subscribe to our Newsletter] [Go to home] [Courses at Recursive Labs] [Connect with me on Twitter/Facebook]