A couple of updates. First, second prototype for the breakout board arrived from BatchPCB (pictured on the right ). I placed an order for the first batch with PCBcart, it is supposed to be here in 2 weeks. Also, I made this prototype public at BatchPCB, this is the product link. The prototype has a little defect – the USB connector is placed a little bit too close to resistors; however, it’s totally buildable, just make sure you insert USB connector last, when the rest is soldered and checked.
Second, I created a code repository for the project. From now on, all firmware development will be posted there. The hardware files don’t change that often; they will still be hosted here in downloads section.
At present, the code doesn’t do much past enumeration. From USB point of view, it knows how to generate control and bulk-IN transfers; bulk-OUT is going to be written together with mass storage client driver code, which is going to be next big step. Also, it is probably buggy and this is my reason for publishing it – “given enough eyeballs, all bugs are shallow”. If you try the code and it doesn’t work, let me know. Or better yet, fork a code, fix it and let me know what you fixed and why.
The code is developed in MPLAB. I use IDE version 8.20 and C18 v3.22. The IDE project file is posted along with source code files; it may or may not work, depending on your setup. If project won’t compile, open the .mcp file in text editor and check file paths. Alternatively, you can make your own project by including all .c files and copy compiler/linker keys from .mcp file.
I use standard PIC headers and linker script – if compiler complains about standard headers, check file paths. In some versions of MPLAB you need to set path to libraries explicitly, even if it’s installed in the default location.
What follows is a short description of code structure and module functions.
MAX3421E.c module contains MAX3421E interface functions, such as single- and multibyte reads and writes, initialization, and interrupt handler intended to be run from the main loop.
transfer.c module contains functions implementing various USB transfers – control and bulk. There is also USB_Task() function, which performs automatic USB tasks, such as resets and enumeration. USB_Task runs from the main loop also.
The cli.c module contains command-line interface functions. It’s primary purpose is to aid in debugging – the facility which shows you MAX3421E registers, USB state machine state and whatever else you might need, is quite handy. I designed it so it can easily be dropped to save memory, CPU time, or when debugging is completed.
I’m hoping to decide what next step I’m going to take with this code – it will be either client driver or Arduino port. In any case, results will be posted here. Stay tuned.
No related posts.