11
2- M-Stack: Free USB Stack for PIC 16F, 18F, 24F, and 32MX Microcontrollers
3- ==========================================================================
2+ M-Stack: Free USB Stack for PIC 16F, 18F, 24F, and 32MX Microcontrollers
3+ ==========================================================================
44
55About
66======
@@ -40,7 +40,7 @@ creating a USB device.
4040Home
4141-----
4242The master web page for this project can be found at:
43- http://www.signal11.us/oss/m-stack/
43+ http://www.signal11.us/oss/m-stack/
4444
4545License
4646========
@@ -86,10 +86,12 @@ Getting Started
8686Downloading the Software
8787-------------------------
8888M-Stack's source code is currently hosted on Github at:
89- https://github.com/signal11/m-stack
89+ https://github.com/signal11/m-stack
9090
9191To get the latest version, run:
92- git clone https://github.com/signal11/m-stack.git
92+ ```
93+ git clone https://github.com/signal11/m-stack.git
94+ ```
9395
9496Documentation
9597--------------
@@ -131,48 +133,53 @@ The USB stack is supported by the following software:
131133 * Microchip MPLAB X IDE
132134
133135Note that the C18 compiler is not currently supported. There are some
134- #defines in the code for C18 because this project came from code that was
136+ ` #defines ` in the code for C18 because this project came from code that was
135137originally done on a PIC18F4550 using C18. It has not yet been determined
136138whether a port to C18 will be made, as C18 has been deprecated by Microchip.
137139Further, C18 has some properties which make a port somewhat more difficult
138140than other compilers.
139141
140142Building the Unit Test Firmware
141143--------------------------------
142- Open the MPLAB.X project in apps/unit_test in the MPLAB X IDE. Select a
144+ Open the MPLAB.X project in ` apps/unit_test ` in the MPLAB X IDE. Select a
143145configuration and build. Make sure a supported compiler is installed.
144146
145147Building the Test Software
146148---------------------------
147- The host_test/ directory contains Libusb-based test programs for testing the
149+ The ` host_test/ ` directory contains Libusb-based test programs for testing the
148150functionality of a USB device running the unit test firmware. Currently the
149151Libusb test software has only been tested Linux, but since its only
150152dependency is the cross-platform Libusb library, it is easily portable to
151153other operating systems on which Libusb is supported.
152154
153- With Libusb installed, run "make" in the host_test/ directory to build the
155+ With Libusb installed, run "make" in the ` host_test/ ` directory to build the
154156test software.
155157
156158Running the Test Software
157159--------------------------
158- ./control_transfer_in [number_of_bytes]
159- * Execute an IN control transfer requesting number_of_bytes bytes
160- from the device. The data returned will be printed. The unit test
161- firmware supports control transfers up to 512 bytes.
162- ./control_transfer_out [number_of_bytes]
163- * Execute an OUT control transfer sending number_of_bytes bytes
164- to the device. A message will be printed. The unit test
165- firmware supports control transfers up to 512 bytes.
166- ./test [number_of_bytes]
167- * Send and then ask for number_of_bytes bytes on EP 1 OUT and EP 1
168- IN, respectively. The data is printed out. The unit test firmware
169- will support up to 128-bytes of this kind of operation.
170- ./feature <clear>
171- * Set the Endpoint halt feature on Endpoint 1 IN. Passing the
172- "clear" parameter clears endpoint halt.
160+ ` ./control_transfer_in [number_of_bytes] `
161+ * Execute an IN control transfer requesting ` number_of_bytes ` bytes
162+ from the device. The data returned will be printed. The unit test
163+ firmware supports control transfers up to 512 bytes.
164+
165+ ` ./control_transfer_out [number_of_bytes] `
166+ * Execute an OUT control transfer sending ` number_of_bytes ` bytes
167+ to the device. A message will be printed. The unit test
168+ firmware supports control transfers up to 512 bytes.
169+
170+ ` ./test [number_of_bytes] `
171+ * Send and then ask for ` number_of_bytes ` bytes on EP 1 OUT and EP 1
172+ IN, respectively. The data is printed out. The unit test firmware
173+ will support up to 128-bytes of this kind of operation.
174+
175+ ` ./feature <clear> `
176+ * Set the Endpoint halt feature on Endpoint 1 IN. Passing the
177+ "clear" parameter clears endpoint halt.
173178
174179Source Tree Structure
175180----------------------
181+
182+ ```
176183(root)
177184 |
178185 +- usb/ <- USB stack software
@@ -189,9 +196,12 @@ Source Tree Structure
189196 +- msc_test/ <- Mass Storage Class example
190197 +- bootloader/ <- USB bootloader firmware and software
191198 +- host_test/ <- Software applications to run from a PC Host
199+ ```
192200
193201USB Stack Source Files
194202-----------------------
203+
204+ ```
195205usb/src/usb.c - The implementation of the USB stack.
196206usb/src/usb_hal.h - Hardware abstraction layer (HAL) containing
197207 differences specific to each platform.
@@ -204,9 +214,12 @@ usb/include/usb_ch9.h - Enums and structs from Chapter 9 of the USB
204214 file from their usb_descriptors.c and from any file
205215 which deals with control transfers.
206216usb/src/usb_hid.h - Enums, structs, and callbacks for the HID class
217+ ```
207218
208219Application Source Files (Unit Test Example)
209220---------------------------------------------
221+
222+ ```
210223apps/unit_test/main.c - Main program file
211224apps/unit_test/usb_config.h - USB stack configuration file. The USB
212225 stack will include this file and use it
@@ -219,29 +232,32 @@ apps/unit_test/usb_descriptors.c - The application's descriptors. The
219232 application's needs.
220233apps/hid_mouse/* - HID mouse example (same files as above)
221234
235+ ```
236+
222237Making Your Own Project
223238------------------------
224239The easiest way to create a project using M-Stack is to simply copy one of
225240the examples and modify it accordingly. Sometimes it's better though to do
226241things the hard way in order to understand better.
227242
228243To create a new project, perform the following steps:
244+
2292451 . Create a new project with MPLAB X.
230- 2. Copy and add the usb/ directory as a subdirectory of your project.
231- 3. Add the usb/include directory to the include path of your project. (Note
246+ 2 . Copy and add the ` usb/ ` directory as a subdirectory of your project.
247+ 3 . Add the ` usb/include ` directory to the include path of your project. (Note
232248 that the include paths are relative to the Makefile. If you set up your
233- project like the examples, with an MPLAB.X/ subdirectory, you'll need to
234- add an additional ../ to the beginning of the include path).
235- 4. Add . to the include path of your project (same note from #3 applies).
236- 5. Copy a usb_config.h and a usb_descriptors.c file from one of the example
249+ project like the examples, with an ` MPLAB.X/ ` subdirectory, you'll need to
250+ add an additional ` ../ ` to the beginning of the include path).
251+ 4 . Add ` . ` to the include path of your project (same note from #3 applies).
252+ 5 . Copy a` usb_config.h ` and a ` usb_descriptors.c ` file from one of the example
237253 projects into your main project directory.
238- 6. Modify usb_config.h to match your desired device configuration.
239- 7. Modify usb_descriptors.c to match your device configuration.
254+ 6 . Modify ` usb_config.h ` to match your desired device configuration.
255+ 7 . Modify ` usb_descriptors.c ` to match your device configuration.
2402568 . If you're using a PIC16F/18F platform, add an interrupt handler similar
241257 to one of the examples.
242- 9. Reference main.c in one of the examples, and the Doxygen-generated
258+ 9 . Reference ` main.c ` in one of the examples, and the Doxygen-generated
243259 documentation to add your application logic.
244- 10. Make sure to configure the MCU for your board (__CONFIG registers, etc.).
260+ 10 . Make sure to configure the MCU for your board (` __CONFIG ` registers, etc.).
245261
246262
247263Limitations
@@ -257,9 +273,10 @@ Future Plans
257273=============
258274
259275The following features are on the horizon:
260- * Support for more specific MCUs
261- * dsPIC33E and PIC24E support
262- * Isochronous transfers
276+
277+ * Support for more specific MCUs
278+ * dsPIC33E and PIC24E support
279+ * Isochronous transfers
263280
264281
265282References
@@ -283,11 +300,11 @@ Contacts
283300Please contact Signal 11 Software directly for support or consulting help.
284301Sometime in the near future there will be a mailing list.
285302
286- Alan Ott
287- Signal 11 Software
288- alan@signal11.us
289- http://www.signal11.us
290- +1 407-222-6975
303+ Alan Ott
304+ Signal 11 Software
305+ alan@signal11.us
306+ http://www.signal11.us
307+ +1 407-222-6975
291308
292- 2013-04-26
309+ 2013-04-26
2933102013-05-20
0 commit comments