README.txt 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. boards/mips/pic32mx/sure-pic32mx README
  2. =====================
  3. This README file discusses the port of NuttX to the "Advanced USB Storage
  4. Demo Board," Model DB-DP11215, from Sure Electronics
  5. (http://www.sureelectronics.net/). This board features the MicroChip
  6. PIC32MX440F512H. See also http://www.sureelectronics.net/goods.php?id=1168
  7. for further information about the Sure DB-DP11215 board.
  8. DB_DP11215 PIC32 Storage Demo Board
  9. - PIC32MX44F512H
  10. - SD card slot
  11. - RS-2323 Interface
  12. - USB (MINI-B)
  13. - 2x16 LCD display
  14. - Three tactile switches
  15. - Four user LEDs
  16. Also available (but not yet supported).
  17. DB-DP11212 PIC32 General Purpose Demo Board
  18. - PIC32MX44F512H
  19. - LM75A temperature sensor and temperature resistor (NTC-SMD thermistor)
  20. - SPI FLASH: AT25DF041A
  21. - USB (MINI-B)
  22. - 2x16 LCD display
  23. - 4 digit, 8 segment LED display
  24. - Three tactile switches
  25. - Four user LEDs
  26. NOTE: I see that Sure Electronics shows both of these boards at end-of-Life
  27. (EOL). So I assume that these boards will no longer be generally available.
  28. This work should still be useful, however, for other PIC32MX4-based boards
  29. (2012-5-27).
  30. Contents
  31. ========
  32. PIC32MX440F512H Pin Out
  33. Toolchains
  34. Loading NuttX with PICkit2
  35. LCD1602
  36. PIC32MX Configuration Options
  37. Configurations
  38. PIC32MX440F512H Pin Out
  39. =======================
  40. DB_DP11215 PIC32 Storage Demo Board
  41. -----------------------------------
  42. PIC32MX440F512H 64-Pin QFN (USB) Pin Out as used on the DB_DP11215 PIC32 Storage
  43. Demo Board.
  44. LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
  45. PIN NAME SIGNAL NOTES
  46. ---- ----------------------------- -------------- -------------------------------
  47. 1 PMD5/RE5 PMPD5 Display, JP1-12, DB4
  48. 2 PMD6/RE6 PMPD6 Display, JP1-13, DB6
  49. 3 PMD7/RE7 PMPD7 Display, JP1-14, DB7
  50. 4 SCK2/PMA5/CN8/RG6 SCK SD connector SCK, FLASH (U1) SCK*
  51. 5 SDI2/PMA4/CN9/RG7 SDI SD connector DO, FLASH (U1) SO*
  52. 6 SDO2/PMA3/CN10/RG8 SDO SD connector DI, FLASH (U1) SI*
  53. 7 MCLR\ PIC_MCLR Pulled high, J7-1, ICSP
  54. 8 SS2/PMA2/CN11/RG9 UTIL_CS FLASH (U1) CS*
  55. 9 Vss Grounded
  56. 10 Vdd +3.3V ---
  57. 11 AN5/C1IN+/Vbuson/CN7/RB5 Vbuson/AN5/RB5 To USB VBUS circuitry
  58. 12 AN4/C1IN-/CN6/RB4 SW_OK SW3, Pull high, low means SW3 closed
  59. 13 AN3/C2IN+/CN5/RB3 SW_UP SW1, Pull high, low means SW1 closed
  60. 14 AN2/C2IN-/CN4/RB2 SW_Down SW2, Pull high, low means SW2 closed
  61. 15 PGEC1/AN1/Vref-/CVref-/CN3/ ADC_SENSE_SWITCHED_+VBUS To USB VBUS circuitry
  62. RB1
  63. 16 PGED1/AN0/VREF+/CVREF+/PMA6/ N/C Not connected
  64. CN2/RB0
  65. *FLASH (U1, SOIC) not populated
  66. BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
  67. PIN NAME SIGNAL NOTES
  68. ---- ----------------------------- -------------- -------------------------------
  69. 17 PGEC2/AN6/OCFA/RB6 PIC_PGC2 J7-5, ICSP
  70. 18 PGED2/AN7/RB7 PIC_PGD2 J7-4, ICSP
  71. 19 AVdd +3.3V ---
  72. 20 AVss Grounded
  73. 21 AN8/U2CTS/C1OUT/RB8 N/C Not connected
  74. 22 AN9/C2OUT/PMA7/RB9 N/C Not connected
  75. 23 TMS/AN10/CVREFOUT/PMA13/RB10 UTIL_WP FLASH (U1) WP*
  76. 24 TDO/AN11/PMA12/RB11 SD_CS SD connector CS
  77. 25 Vss Grounded
  78. 26 Vdd +3.3V ---
  79. 27 TCK/AN12/PMA11/RB12 SD_CD SD connector CD
  80. 28 TDI/AN13/PMA10/RB13 SD_WD SD connector WD
  81. 29 AN14/U2RTS/PMALH/PMA1/RB14 N/C Not connected
  82. 30 AN15/OCFB/PMALL/PMA0/CN12/ PMPA0 Display, JP1-4, RS
  83. RB15
  84. 31 SDA2/U2RX/PMA9/CN17/RF4 RXD2_MCU J5 DB9 via RS232 driver
  85. 32 SCL2/U2TX/PMA8/CN18/RF5 TXD2_MCU J5 DB9 via RS232 driver
  86. *FLASH (U1, SOIC) not populated
  87. RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
  88. PIN NAME SIGNAL NOTES
  89. ---- ----------------------------- -------------- -------------------------------
  90. 48 SOSCO/T1CK/CN0/RC14 SOSCO 32.768KHz XTAL (Y1)
  91. 47 SOSCI/CN1/RC13 SOSCI 32.768KHz XTAL (Y1)
  92. 46 OC1/INT0/RD0 PWM1 Used to control backlight level (K)
  93. 45 IC4/PMCS1/PMA14/INT4/RD11 PMPCS1 Display, JP1-6, E
  94. 44 SCL1/IC3/PMCS2/PMA15/INT3/ USB_OPT USB PHY
  95. RD10
  96. 43 U1CTS/SDA1/IC2/INT2/RD9 USB_OPTEN USB PHY
  97. 42 RTCC/IC1/INT1/RD8 N/C Not connected
  98. 41 Vss Grounded
  99. 40 OSC2/CLKO/RC15 OSC2 20MHz XTAL (Y2)
  100. 39 OSC1/CLKI/RC12 OSC1 20MHz XTAL (Y2)
  101. 38 Vdd +3.3V ---
  102. 37 D+/RG2 APPS_D+ USB connectors via PHY
  103. 36 D-/RG3 APPS_D- USB connectors via PHY
  104. 35 Vusb +3.3V ---
  105. 34 Vbus VBUS_DEVICE_MODE Display, USB Mini-B, USB Type A, JP1-1, +5V
  106. 33 USBID/RF3 N/C Not connected
  107. TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
  108. PIN NAME SIGNAL NOTES
  109. ---- ----------------------------- -------------- -------------------------------
  110. 64 PMPD4/RE4 PMPD4 Display, JP1-11, DB4
  111. 63 PMPD3/RE3 PMPD3 Display, JP1-10, DB3
  112. 62 PMPD2/RE2 PMPD2 Display, JP1-9, DB2
  113. 61 PMPD1/RE1 PMPD1 Display, JP1-8, DB1
  114. 60 PMPD0/RE0 PMPD0 Display, JP1-7, DB0
  115. 59 RF1 RF1 Low illuminates LED/R/ERR
  116. 58 RF0 RF0 Low illuminates LED/Y/flash
  117. 57 ENVREG ENVREG Pulled high
  118. 56 Vcap/Vddcore VDDCORE Capactors to ground
  119. 55 CN16/RD7 RD7 Low illuminates LED/Y/USB
  120. 54 CN15/RD6 RD6 Low illuminates LED/Y/SD
  121. 53 PMRD/CN14/RD5 PMPRD Display, JP1-5, R/W
  122. 52 OC5/IC5/PMWR/CN13/RD4 N/C Not connected
  123. 51 U1TX/OC4/RD3 CP2102_RXD J6-3, UART1 (also CP2102*)
  124. 50 U1RX/OC3/RD2 CP2102_TXD J6-2, UART1 (also CP2102*)
  125. 49 U1RTS/OC2/RD1 PWM2 Used to control backlight level (Vo)
  126. *USB-to-UART bridge (U1, CP2102) not populated
  127. DB-DP11212 PIC32 General Purpose Demo Board
  128. -------------------------------------------
  129. PIC32MX440F512H 64-Pin QFN (USB) Pin Out as used on the DB-DP11212 PIC32 General
  130. Purpose Demo Board
  131. LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
  132. PIN NAME SIGNAL NOTES
  133. ---- ----------------------------- -------------- -------------------------------
  134. 1 PMD5/RE5 PMPD5 Display, JP1-12, DB5
  135. 2 PMD6/RE6 PMPD6 Display, JP1-13, DB6
  136. 3 PMD7/RE7 PMPD7 Display, JP1-14, DB7
  137. 4 SCK2/PMA5/CN8/RG6 SCK FLASH (U4) SCK*
  138. 5 SDI2/PMA4/CN9/RG7 SDI FLASH (U4) SO*
  139. 6 SDO2/PMA3/CN10/RG8 SDO FLASH (U4) SI*
  140. 7 MCLR\ PIC_MCLR Pulled high, J2-1, ICSP
  141. 8 SS2/PMA2/CN11/RG9 N/C Not connected
  142. 9 Vss Grounded
  143. 10 Vdd +3.3V ---
  144. 11 Vbuson/AN5/CN7/RB5 RB5 LCD SEG5 (F), U5-10
  145. 12 AN4/CN6/RB4 RB4 LCD SEG4 (E), U5-1
  146. 13 AN3/CN5/RB3 RB3 LCD SEG3 (D), U5-2
  147. 14 AN2/CN4/RB2 RB2 LCD SEG2 (C), U5-4
  148. 15 PGEC1/AN1/Vref-/CN3/RB1 RB1 LCD SEG1 (B), U5-7
  149. 16 PGED1/AN0/VREF+/CVREF+/PMA6/ RB0 LCD SEG0 (A), U5-11
  150. CN2/RB0
  151. *FLASH (U4, SOIC) not populated
  152. BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
  153. PIN NAME SIGNAL NOTES
  154. ---- ----------------------------- -------------- -------------------------------
  155. 17 PGEC2/AN6/OCFA/RB6 PIC_PGC2 J2-5, ICSP
  156. 18 PGED2/AN7/RB7 PIC_PGD2 J2-4, ICSP
  157. 19 AVdd +3.3V ---
  158. 20 AVss Grounded
  159. 21 AN8/U2CTS/RB8 RB8 LCD SEG6 (G), U5-5
  160. 22 AN9/PMA7/RB9 RB9 LCD SEG7 (DP), U5-3
  161. 23 TMS/AN10/PMA13/RB10 UTIL_WP FLASH (U4) WP*
  162. 24 TDO/AN11/PMA12/RB11 UTIL_CS FLASH (U4) CS*
  163. 25 Vss Grounded
  164. 26 Vdd +3.3V ---
  165. 27 TCK/AN12/PMA11/RB12 N/C Not connected
  166. 28 TDI/AN13/PMA10/RB13 N/C Not connected
  167. 29 AN14/U2RTS/PMA1/RB14 temp_AD temp_AD
  168. 30 AN15/PMA0/CN12/RB15 PMPA0 Display, JP1-4, RS
  169. 31 SDA2/U2RX/PMA9/CN17/RF4 SDA LM75/SO, U3-1, SDA
  170. 32 SCL2/U2TX/PMA8/CN18/RF5 SCL LM75/SO, U3-2, SCL
  171. *FLASH (U4, SOIC) not populated
  172. RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
  173. PIN NAME SIGNAL NOTES
  174. ---- ----------------------------- -------------- -------------------------------
  175. 48 SOSCO/T1CK/CN0/RC14 SOSCO 32.768KHz XTAL (Y1)
  176. 47 SOSCI/CN1/RC13 SOSCI 32.768KHz XTAL (Y1)
  177. 46 OC1/INT0/RD0 RD0 LCD DIG1, U5-12
  178. 45 IC4/PMCS1/PMA14/RD11 PMCS1 Display, JP1-6, E
  179. 44 SCL1/PMCS2/PMA15 RD10 LCD DIG2, U5-9
  180. 43 SDA1/RD9 RD9 LCD DIG3, U5-8
  181. 42 RTCC/RD8 RD8 LCD DIG4, U5-6
  182. 41 Vss Grounded
  183. 40 OSC2/CLKO/RC15 OSC2 20MHz XTAL (Y2)
  184. 39 OSC1/CLKI/RC12 OSC1 20MHz XTAL (Y2)
  185. 38 Vdd +3.3V ---
  186. 37 D+ MCU_D+ USB connectors via PHY
  187. 36 D- MCU_D- USB connectors via PHY
  188. 35 Vusb +3.3V ---
  189. 34 Vbus +5V_DUSB Display, USB Mini-B, USB Type A, JP1-1, +5V
  190. 33 USBID/RF3 N/C Not connected
  191. TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
  192. PIN NAME SIGNAL NOTES
  193. ---- ----------------------------- -------------- -------------------------------
  194. 64 PMPD4/RD4 PMPD4 Display, JP1-11, DB4
  195. 63 PMPD3/RD3 PMPD3 Display, JP1-10, DB3
  196. 62 PMPD2/RD2 PMPD2 Display, JP1-9, DB2
  197. 61 PMPD1/RD1 PMPD1 Display, JP1-8, DB1
  198. 60 PMPD0/RE0 PMPD0 Display, JP1-7, DB0
  199. 59 RF1 Key3 SW3-1
  200. 58 RF0 Key2 SW2-1
  201. 57 ENVREG ENVREG Pulled high
  202. 56 Vcap/Vddcore VDDCORE Capacitors to ground
  203. 55 CN16/RD7 N/C Not connected
  204. 54 CN15/RD6 Key5 SW5-1
  205. 53 PMRD/CN14/RD5 PMPRD ---
  206. 52 OC5/PMWR/CN13/RD4 PWM2 Used to control backlight level (Vo)
  207. 51 U1TX/OC4/RD3 N/C Not connected
  208. 50 U1RX/OC3/RD2 N/C Not connected
  209. 49 OC2/RD1 PWM1 Used to control backlight level (K)
  210. Toolchains
  211. ==========
  212. MPLAB/C32
  213. ---------
  214. I am using the free, "Lite" version of the PIC32MX toolchain available
  215. for download from the microchip.com web site. I am using the Windows
  216. version. The MicroChip toolchain is the only toolchain currently
  217. supported in these configurations, but it should be a simple matter to
  218. adapt to other toolchains by modifying the Make.defs file include in
  219. each configuration.
  220. C32 Toolchain Options:
  221. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW - MicroChip full toolchain for Windows
  222. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL - MicroChip full toolchain for Linux
  223. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
  224. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
  225. CONFIG_MIPS32_TOOLCHAIN_PINGUINOL - Pinquino toolchain for Linux
  226. CONFIG_MIPS32_TOOLCHAIN_PINGUINOW - Pinquino toolchain for Windows
  227. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPOPENL - Microchip open toolchain for Linux
  228. CONFIG_MIPS32_TOOLCHAIN_GNU_ELF - General mips-elf toolchain for Linux
  229. NOTE: The "Lite" versions of the toolchain does not support C++. Also
  230. certain optimization levels are not supported by the "Lite" toolchain.
  231. MicrochipOpen
  232. -------------
  233. An alternative, build-it-yourself toolchain is available here:
  234. http://sourceforge.net/projects/microchipopen/ . These tools were
  235. last updated circa 2010. NOTE: C++ support still not available
  236. in this toolchain.
  237. Building MicrochipOpen (on Linux)
  238. 1) Get the build script from this location:
  239. http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
  240. 2) Build the code using the build script, for example:
  241. ./build.sh -b v105_freeze
  242. This will check out the selected branch and build the tools.
  243. 3) Binaries will then be available in a subdirectory with a name something like
  244. pic32-v105-freeze-20120622/install-image/bin (depending on the current data
  245. and the branch that you selected.
  246. Note that the tools will have the prefix, mypic32- so, for example, the
  247. compiler will be called mypic32-gcc.
  248. Penguino mips-elf Toolchain
  249. ---------------------------
  250. Another option is the mips-elf toolchain used with the Penguino project. This
  251. is a relatively current mips-elf GCC and should provide free C++ support as
  252. well. This toolchain can be downloaded from the Penguino website:
  253. http://wiki.pinguino.cc/index.php/Main_Page#Download .
  254. See also boards/mirtoo/README.txt. There is an experimental (untested)
  255. configuration for the Mirtoo platform in that directory.
  256. MPLAB/C32 vs MPLABX/X32
  257. -----------------------
  258. It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
  259. it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
  260. with the NuttX build scripts. Here are some of the issues that I see when trying
  261. to build with XC32:
  262. 1) Make.def changes: You have to change the tool prefix:
  263. CROSSDEV=xc32-
  264. 2) debug.ld/release.ld: The like expect some things that are not present in
  265. the current linker scripts (or are expected with different names). Here
  266. are some partial fixes:
  267. Rename: kseg0_progmem to kseg0_program_mem
  268. Rename: kseg1_datamem to kseg1_data_mem
  269. Even then, there are more warnings from the linker and some undefined symbols
  270. for non-NuttX code that resides in the unused Microchip libraries. You will
  271. have to solve at least this undefined symbol problem if you want to used the
  272. XC32 toolchain.
  273. Windows Native Toolchains
  274. -------------------------
  275. NOTE: There are several limitations to using a Windows based toolchain in a
  276. Cygwin environment. The three biggest are:
  277. 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
  278. performed automatically in the Cygwin makefiles using the 'cygpath' utility
  279. but you might easily find some new path problems. If so, check out 'cygpath -w'
  280. 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
  281. are used in NuttX (e.g., include/arch). The make system works around these
  282. problems for the Windows tools by copying directories instead of linking them.
  283. But this can also cause some confusion for you: For example, you may edit
  284. a file in a "linked" directory and find that your changes had no effect.
  285. That is because you are building the copy of the file in the "fake" symbolic
  286. directory. If you use a Windows toolchain, you should get in the habit of
  287. making like this:
  288. make clean_context all
  289. An alias in your .bashrc file might make that less painful.
  290. Loading NuttX with PICkit2
  291. ==========================
  292. NOTE: You need a PICKit3 if you plan to use the MPLAB debugger! The PICKit2
  293. can, however, still be used to load programs. Instructions for the PICKit3
  294. are similar.
  295. Intel Hex Forma Files:
  296. ----------------------
  297. When NuttX is built it will produce two files in the top-level NuttX
  298. directory:
  299. 1) nuttx - This is an ELF file, and
  300. 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
  301. the setting CONFIG_INTELHEX_BINARY in the .config file.
  302. The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
  303. there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
  304. file to contain physical addresses. But the nuttx.hex file generated from the
  305. top-level make will have address in the KSEG0 and KSEG1 regions.
  306. tools/pic32/mkpichex:
  307. ----------------------
  308. There is a simple tool in the NuttX tools/pic32 directory that can be
  309. used to solve both issues with the nuttx.hex file. But, first, you must
  310. build the tool:
  311. cd tools/pic32
  312. make -f Makefile.host
  313. Now you will have an executable file call mkpichex (or mkpichex.exe on
  314. Cygwin). This program will take the nutt.hex file as an input, it will
  315. convert all of the KSEG0 and KSEG1 addresses to physical address, and
  316. it will write the modified file, replacing the original nuttx.hex.
  317. To use this file, you need to do the following things:
  318. export PATH = ??? # Add the NuttX tools/pic32 directory to your
  319. # PATH variable
  320. make # Build nuttx and nuttx.hex
  321. mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
  322. # to the top-level build directory. It is the only
  323. # required input to mkpichex.
  324. This procedure is automatically performed at the end of a build.
  325. LCD1602
  326. =======
  327. The on-board LCD is a 2x16 segment LCD and appears to be compatible with
  328. the LCD1602 and is treated like an LCD1602 LCD here.
  329. LCD pin mapping
  330. --------------------- ---------- ----------------------------------
  331. PIC32 Sure JP1 Sure Signal Description
  332. PIN SIGNAL NAME PIN NAME(s)
  333. --------------------- ---------- ----------------------------------
  334. 34 Vbus 1. +5V +5V VBUS device mode
  335. To GND via capacitor
  336. 2. GND GND
  337. 49 RD1 3. Vo Transistor circuit driven by PWM2
  338. 44 PMA0/AN15/RB15 4. RS PMA0, Selects registers
  339. 53 PMRD/RD5 5. RW PMRD/PMWR, Selects read or write
  340. 45 PMPCS1/RD11 6. E Starts data read/write
  341. 60 PMD0/RE0 7. DB0 PMD0
  342. 61 PMD1/RE1 8. DB1 PMD1
  343. 62 PMD2/RE2 9. DB2 PMD2
  344. 63 PMD3/RE3 10. DB3 PMD3
  345. 64 PMD4/RE4 11. DB4 PMD4
  346. 1 PMD5/RE5 12. DB5 PMD5
  347. 2 PMD6/RE6 13. DB6 PMD6
  348. 3 PMD7/RE7 14. DB7 PMD7
  349. 15. A +5V_DUSB
  350. 46 INT0/RD0 16. K Transistor circuit driven by PWM1
  351. --------------------- ---------- ----------------------------------
  352. Vbus power also requires Vbuson/AN5/RB5
  353. PIC32MX Configuration Options
  354. =============================
  355. General Architecture Settings:
  356. CONFIG_ARCH - Identifies the arch/ subdirectory. This should
  357. be set to:
  358. CONFIG_ARCH=mips
  359. CONFIG_ARCH_family - For use in C code:
  360. CONFIG_ARCH_MIPS=y
  361. CONFIG_ARCH_architecture - For use in C code:
  362. CONFIG_ARCH_MIPS32=y
  363. CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
  364. CONFIG_ARCH_CHIP=pic32mx
  365. CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
  366. chip:
  367. CONFIG_ARCH_CHIP_PIC32MX440F512H=y
  368. CONFIG_ARCH_BOARD - Identifies the boards/ subdirectory and
  369. hence, the board that supports the particular chip or SoC.
  370. CONFIG_ARCH_BOARD=sure-pic32mx
  371. CONFIG_ARCH_DBDP11215 Distinguishes the DB_DP11215 PIC32 Storage
  372. Demo Board
  373. CONFIG_ARCH_DBDP11212 Distingustes the DB-DP11212 PIC32 General
  374. Purpose Demo Board
  375. CONFIG_ARCH_BOARD_name - For use in C code
  376. CONFIG_ARCH_BOARD_SUREPIC32MX=y
  377. CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
  378. of delay loops
  379. CONFIG_ENDIAN_BIG - define if big endian (default is little
  380. endian)
  381. CONFIG_RAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
  382. CONFIG_RAM_SIZE=(32*1024) (32Kb)
  383. There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
  384. CONFIG_RAM_START - The start address of installed DRAM
  385. CONFIG_RAM_START=0xa0000000
  386. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
  387. have LEDs
  388. CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
  389. stack. If defined, this symbol is the size of the interrupt
  390. stack in bytes. If not defined, the user task stacks will be
  391. used during interrupt handling.
  392. CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
  393. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
  394. PIC32MX Configuration
  395. CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
  396. Individual subsystems can be enabled:
  397. CONFIG_PIC32MX_WDT - Watchdog timer
  398. CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
  399. CONFIG_PIC32MX_T3 - Timer 3
  400. CONFIG_PIC32MX_T4 - Timer 4
  401. CONFIG_PIC32MX_T5 - Timer 5
  402. CONFIG_PIC32MX_IC1 - Input Capture 1
  403. CONFIG_PIC32MX_IC2 - Input Capture 2
  404. CONFIG_PIC32MX_IC3 - Input Capture 3
  405. CONFIG_PIC32MX_IC4 - Input Capture 4
  406. CONFIG_PIC32MX_IC5 - Input Capture 5
  407. CONFIG_PIC32MX_OC1 - Output Compare 1
  408. CONFIG_PIC32MX_OC2 - Output Compare 2
  409. CONFIG_PIC32MX_OC3 - Output Compare 3
  410. CONFIG_PIC32MX_OC4 - Output Compare 4
  411. CONFIG_PIC32MX_OC5 - Output Compare 5
  412. CONFIG_PIC32MX_I2C1 - I2C 1
  413. CONFIG_PIC32MX_I2C2 - I2C 2
  414. CONFIG_PIC32MX_SPI2 - SPI 2
  415. CONFIG_PIC32MX_UART1 - UART 1
  416. CONFIG_PIC32MX_UART2 - UART 2
  417. CONFIG_PIC32MX_ADC - ADC 1
  418. CONFIG_PIC32MX_PMP - Parallel Master Port
  419. CONFIG_PIC32MX_CM1 - Comparator 1
  420. CONFIG_PIC32MX_CM2 - Comparator 2
  421. CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
  422. CONFIG_PIC32MX_DMA - DMA
  423. CONFIG_PIC32MX_FLASH - FLASH
  424. CONFIG_PIC32MX_USBDEV - USB device
  425. CONFIG_PIC32MX_USBHOST - USB host
  426. PIC32MX Configuration Settings
  427. DEVCFG0:
  428. CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
  429. value 2 enables.
  430. CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
  431. Default 1 (PG2)
  432. CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
  433. CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
  434. CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
  435. DEVCFG1: (All settings determined by selections in board.h)
  436. DEVCFG2: (All settings determined by selections in board.h)
  437. DEVCFG3:
  438. CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
  439. (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
  440. CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
  441. (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
  442. CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
  443. can be enabled later by software).
  444. The priority of interrupts may be specified. The value ranage of
  445. priority is 4-31. The default (16) will be used if these any of these
  446. are undefined.
  447. CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
  448. CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
  449. CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
  450. CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
  451. CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
  452. CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
  453. CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
  454. CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
  455. CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
  456. CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
  457. CONFIG_PIC32MX_T2PRIO - Timer 2 priority
  458. CONFIG_PIC32MX_T3PRIO - Timer 3 priority
  459. CONFIG_PIC32MX_T4PRIO - Timer 4 priority
  460. CONFIG_PIC32MX_T5PRIO - Timer 5 priority
  461. CONFIG_PIC32MX_IC1PRIO - Input Capture 1
  462. CONFIG_PIC32MX_IC2PRIO - Input Capture 2
  463. CONFIG_PIC32MX_IC3PRIO - Input Capture 3
  464. CONFIG_PIC32MX_IC4PRIO - Input Capture 4
  465. CONFIG_PIC32MX_IC5PRIO - Input Capture 5
  466. CONFIG_PIC32MX_OC1PRIO - Output Compare 1
  467. CONFIG_PIC32MX_OC2PRIO - Output Compare 2
  468. CONFIG_PIC32MX_OC3PRIO - Output Compare 3
  469. CONFIG_PIC32MX_OC4PRIO - Output Compare 4
  470. CONFIG_PIC32MX_OC5PRIO - Output Compare 5
  471. CONFIG_PIC32MX_I2C1PRIO - I2C 1
  472. CONFIG_PIC32MX_I2C2PRIO - I2C 2
  473. CONFIG_PIC32MX_SPI2PRIO - SPI 2
  474. CONFIG_PIC32MX_UART1PRIO - UART 1
  475. CONFIG_PIC32MX_UART2PRIO - UART 2
  476. CONFIG_PIC32MX_CN - Input Change Interrupt
  477. CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
  478. CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
  479. CONFIG_PIC32MX_CM1PRIO - Comparator 1
  480. CONFIG_PIC32MX_CM2PRIO - Comparator 2
  481. CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
  482. CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
  483. CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
  484. CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
  485. CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
  486. CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
  487. CONFIG_PIC32MX_FCEPRIO - Flash Control Event
  488. CONFIG_PIC32MX_USBPRIO - USB
  489. PIC32MXx specific device driver settings. NOTE: For the Sure board,
  490. UART2 is brought out to the DB9 connector and serves as the serial
  491. console.
  492. CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
  493. console and ttys0 (default is the UART0).
  494. CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
  495. This specific the size of the receive buffer
  496. CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
  497. being sent. This specific the size of the transmit buffer
  498. CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
  499. CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
  500. CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
  501. CONFIG_UARTn_2STOP - Two stop bits
  502. PIC32MXx USB Device Configuration
  503. PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
  504. Configurations
  505. ==============
  506. Each PIC32MX configuration is maintained in a sub-directory and can be
  507. selected as follow:
  508. tools/configure.sh sure-pic32mx:<subdir>
  509. Where <subdir> is one of the following sub-directories.
  510. NOTE: These configurations use the mconf-based configuration tool. To
  511. change any of these configurations using that tool, you should:
  512. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  513. see additional README.txt files in the NuttX tools repository.
  514. b. Execute 'make menuconfig' in nuttx/ in order to start the
  515. reconfiguration process.
  516. Configuration sub-directories
  517. -----------------------------
  518. Where <subdir> is one of the following:
  519. nsh:
  520. ====
  521. Description.
  522. ------------
  523. Configures the NuttShell (nsh) located at apps/examples/nsh. The
  524. Configuration enables only the serial NSH interface.
  525. Notes.
  526. -----
  527. 1. By default, this configuration uses an older Microchip C32 toolchain
  528. for Windows (the newer ones seem to be incompatible) and builds under
  529. Cygwin (or probably MSYS). That can easily be reconfigured, of course.
  530. Build Setup:
  531. CONFIG_HOST_WINDOWS=y : Builds under Windows
  532. CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
  533. System Type:
  534. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y : Older C32 toolchain
  535. 2. USB Configurations.
  536. Several USB device configurations can be enabled and included
  537. as NSH built-in built in functions. All require the following
  538. basic setup in your .config to enable USB device support:
  539. Drivers:
  540. CONFIG_USBDEV=y : Enable basic USB device support
  541. System Type -> PIC32MX Peripheral Support:
  542. CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
  543. system/cdcacm - The system/cdcacm program can be included as an
  544. function by dding the following to the NuttX configuration file:
  545. Application Configuration->Examples:
  546. CONFIG_SYSTEM_CDCACM=y : Select apps/system/cdcacm
  547. and defining the following in your .config file:
  548. Drivers->USB Device Driver Support
  549. CONFIG_CDCACM=y : Enable the CDCACM device
  550. system/usbmsc - To enable the USB mass storage class (MSC)device,
  551. you would need to add the following to the NuttX configuration file.
  552. However, this device cannot work until support for the SD card is
  553. also incorporated.
  554. Drivers->USB Device Driver Support
  555. CONFIG_USBMSC=y : Enables the USB MSC class
  556. Application Configuration->Examples:
  557. CONFIG_SYSTEM_USBMSC=y : Enhables apps/system/usbmsc
  558. 3. SD Card Support.
  559. Support for the on-board, SPI-based SD card is available but is
  560. not yet functional (at least at the time of this writing). SD
  561. card support can be enabled for testing by simply enabling SPI2
  562. support in the configuration file:
  563. System Type -> PIC32MX Peripheral Support:
  564. CONFIG_PIC32MX_SPI2=y : Enable SPI2
  565. Drivers:
  566. CONFIG_MMCSD=y : MMC/SD support
  567. CONFIG_MMCSD_SPI=y : SPI-based MMC/SD support
  568. File Systems:
  569. CONFIG_FS_FAT=y : FAT file system
  570. : Other FAT options
  571. Debug output for testing the SD card can be enabled using:
  572. Build Setup:
  573. CONFIG_DEBUG_FEATURES=y : Enable debug features
  574. CONFIG_DEBUG_INFO=y : Enable verbose debug output
  575. CONFIG_DEBUG_FS=y : Enable file system debug
  576. CONFIG_DEBUG_SPI=y : Enable SPI debug
  577. 4. To enable LCD1602 support:
  578. Device Drivers ->LCD Driver Support:
  579. CONFIG_LCD=y : Enable LCD menus
  580. CONFIG_LCD_LCD1602=y : Select LCD1602
  581. CONFIG_LCD_MAXCONTRAST=255 : (Or any large-ish value that you prefer)
  582. CONFIG_LCD_MAXPOWER=255 : (Or any large-ish value that you prefer)
  583. Library Routines:
  584. CONFIG_LIB_SLCDCODEC=y : Enable the SLCD CODEC
  585. NOTE that is is not necessary to select the PMP peripheral; this LCD
  586. driver is a bit-bang driver that just happens to use the PMP pins as
  587. GPIOS.
  588. To enable apps/examples/slcd to test the LCD:
  589. Application Configuration -> NSH Library:
  590. CONFIG_NSH_ARCHINIT=y : Needed to initialize the SLCD
  591. Application Configuration -> Examples:
  592. CONFIG_EXAMPLES_SLCD=y : Enable apps/examples/slcd use /dev/lcd1602
  593. CONFIG_EXAMPLES_SLCD_DEVNAME="/dev/lcd1602"
  594. To enable LCD debug output:
  595. Build Setup -> Debug Options:
  596. CONFIG_DEBUG_FEATURES=y : Enable debug features
  597. CONFIG_DEBUG_INFO=y : Enable verbose debug output
  598. CONFIG_DEBUG_LCD=y : Enable LCD debug output
  599. NOTES:
  600. 2013-05-27: The LCD1602 has been verified on the DB-DP11212 using
  601. this configuration. It has not been used with the usbnsh configuration
  602. or with the DB-11112 board. It looks to me like the connection to the
  603. LCD1602 is identical on the DB-11112 and so I would expect that to work.
  604. At this point in time, testing of the SLCD is very limited because
  605. there is not much in apps/examples/slcd. Basically driver with a working
  606. test setup and ready to be tested and debugged.
  607. usbnsh:
  608. =======
  609. Description.
  610. ------------
  611. This is another NSH example. If differs from the 'nsh' configuration
  612. above in that this configurations uses a USB serial device for console
  613. I/O. This configuration was created to support the "DB-DP11212 PIC32
  614. General Purpose Demo Board" which has no easily accessible serial port.
  615. However, as of this writing, the configuration has set for the
  616. "DB_DP11215 PIC32 Storage Demo Board" and has only be testing on that
  617. board.
  618. Notes.
  619. -----
  620. 1. By default, this configuration uses an older Microchip C32 toolchain
  621. for Windows (the newer ones seem to be incompatible) and builds under
  622. Cygwin (or probably MSYS). That can easily be reconfigured, of course.
  623. Build Setup:
  624. CONFIG_HOST_WINDOWS=y : Builds under Windows
  625. CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
  626. System Type:
  627. CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y : Older C32 toolchain
  628. 2. Comparison to nsh
  629. Below summarizes the key configuration differences between the 'nsh'
  630. and the 'upnsh' configurations:
  631. CONFIG_USBDEV=y : NuttX USB device support is enabled
  632. CONFIG_PIC32MX_USBDEV=y : The PIC32MX USB device driver is built
  633. CONFIG_DEV_CONSOLE=n : /dev/console does not exist on power up
  634. CONFIG_UART1_SERIAL_CONSOLE=n : There is no serial console
  635. CONFIG_UART2_SERIAL_CONSOLE=n :
  636. CONFIG_CDCACM=y : The CDC/ACM serial device class is enabled
  637. CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is the console
  638. 3. Using the Prolifics PL2303 Emulation
  639. You could also use the non-standard PL2303 serial device instead of
  640. the standard CDC/ACM serial device by changing:
  641. Drivers->USB Device Driver Support
  642. CONFIG_CDCACM=n : Disable the CDC/ACM serial device class
  643. CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console
  644. CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
  645. CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console
  646. Why would you want to use a non-standard USB serial driver? You might
  647. to use the PL2303 driver with a Windows host because it should
  648. automatically install the PL2303 driver (you might have to go through
  649. some effort to get Windows to recognize the CDC/ACM device).
  650. 4. Since this configuration is current set for the "DB_DP11215 PIC32
  651. Storage Demo Board," UART2 is available and is configured to used as
  652. the SYSLOG device. That means that all debug output will be directed
  653. out UART2. Debug output is not enabled by default, however, so these
  654. settings do nothing until you enable debug output.
  655. Device Drivers -> System Logging Device Options:
  656. CONFIG_SYSLOG_CHAR=y
  657. CONFIG_SYSLOG_DEVPATH="/dev/ttyS0"
  658. System Type -> PIC32MX Peripheral Support:
  659. CONFIG_PIC32MX_UART2=y : Enable UART2
  660. Device Drivers -> Serial Driver Support:
  661. CONFIG_UART2_2STOP=0 : UART2 configuration
  662. CONFIG_UART2_BAUD=115200
  663. CONFIG_UART2_BITS=8
  664. CONFIG_UART2_PARITY=0
  665. CONFIG_UART2_RXBUFSIZE=64
  666. CONFIG_UART2_TXBUFSIZE=64
  667. NOTE: Using the SYSLOG to get debug output has limitations. Among
  668. those are that you cannot get debug output from interrupt handlers.
  669. So, in particularly, debug output is not a useful way to debug the
  670. USB device controller driver. Instead, use the USB monitor with
  671. USB debug off and USB trance on (see below).
  672. 5. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB
  673. device will save encoded trace output in in-memory buffer; if the
  674. USB monitor is enabled, that trace buffer will be periodically
  675. emptied and dumped to the system logging device (UART2 in this
  676. configuration):
  677. Device Drivers -> "USB Device Driver Support:
  678. CONFIG_USBDEV_TRACE=y : Enable USB trace feature
  679. CONFIG_USBDEV_TRACE_NRECORDS=256 : Buffer 256 records in memory
  680. Application Configuration -> NSH LIbrary:
  681. CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH
  682. CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor
  683. Application Configuration -> System NSH Add-Ons:
  684. CONFIG_USBMONITOR=y : Enable the USB monitor daemon
  685. CONFIG_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
  686. CONFIG_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
  687. CONFIG_USBMONITOR_INTERVAL=1 : Dump trace data every second
  688. CONFIG_USBMONITOR_TRACEINIT=y : Enable TRACE output
  689. CONFIG_USBMONITOR_TRACECLASS=y
  690. CONFIG_USBMONITOR_TRACETRANSFERS=y
  691. CONFIG_USBMONITOR_TRACECONTROLLER=y
  692. CONFIG_USBMONITOR_TRACEINTERRUPTS=y
  693. NOTE: USB debug output also be enabled in this case. Both will appear
  694. on the serial SYSLOG output. However, the debug output will be
  695. asynchronous with the trace output and, hence, difficult to interpret.
  696. 6. If you want to try this configuration on the DB-DP11212 PIC32 General
  697. Purpose Demo Board", here are the changes that you should make:
  698. Board Configuration:
  699. CONFIG_ARCH_DBDP11215=n : Disable the DB-DP11215
  700. CONFIG_ARCH_DBDP11212=y : Enable the DB-DP11212
  701. CONFIG_ARCH_LEDS=n : The DB-DP11212 has no LEDs
  702. System Type -> PIC32MX Peripheral Support:
  703. CONFIG_PIC32MX_UART2=n : Disable UART2
  704. The SYSLOG output on UART2 cannot by used. You have two choices,
  705. first, you can simply disable the SYSLOG device. Then 1) debug
  706. output will come the USB console, and 2) all debug output prior
  707. to connecting the USB console will be lost:
  708. The second options is to configure a RAM SYSLOG device. This is
  709. a circular buffer that accumulated debug output in memory. The
  710. contents of the circular buffer can be dumped from the NSH command
  711. line using the 'dmesg' command.
  712. Device Drivers -> System Logging Device Options:
  713. CONFIG_RAMLOG=y : Enable the RAM-based logging feature.
  714. CONFIG_RAMLOG_SYSLOG=y : This enables the RAM-based logger as the
  715. system logger.
  716. Logging is currently can be set up to use any amount of memory (here 8KB):
  717. CONFIG_RAMLOG_BUFSIZE=8192
  718. STATUS:
  719. 2013-7-4: This configuration was last verified.
  720. 7. See the notes for the nsh configuration. Most also apply to the usbnsh
  721. configuration as well.