diff --git a/configs/arduino-due/nsh/defconfig b/configs/arduino-due/nsh/defconfig index 15814e72310..a791c14a5b1 100644 --- a/configs/arduino-due/nsh/defconfig +++ b/configs/arduino-due/nsh/defconfig @@ -11,9 +11,6 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_LOOPSPERMSEC=6965 CONFIG_BUILTIN=y CONFIG_CXX_NEWLONG=y -CONFIG_DISABLE_ENVIRON=y -CONFIG_DISABLE_MOUNTPOINT=y -CONFIG_DISABLE_POLL=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y CONFIG_EXAMPLES_NSH=y CONFIG_FS_PROCFS=y @@ -24,6 +21,7 @@ CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=3 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 @@ -40,7 +38,7 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 -CONFIG_TASK_NAME_SIZE=0 +CONFIG_TASK_NAME_SIZE=32 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/flipnclick-pic32mz/README.txt b/configs/flipnclick-pic32mz/README.txt index 3a1c3575d6d..6e11eaffdd2 100644 --- a/configs/flipnclick-pic32mz/README.txt +++ b/configs/flipnclick-pic32mz/README.txt @@ -14,6 +14,7 @@ Contents Creating Compatible NuttX HEX files Tool Issues Serial Console + SPI LEDs Configurations @@ -146,6 +147,39 @@ Serial Console transceiver to get the signals to RS232 levels (or connect to the USB virtual COM port in the case of UART0). +SPI +=== + + SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + you would expect then. The SPI connector is configured as follows: + + Pin J1 Board Signal PIC32MZ + --- -- ------------ ------- + D10 8 SPI3_SCK RB14 + D10 7 SPI3_MISO RB9 + D11 6 SPI3_MOSI RB10 + D13 5 SPI3_SS RB9 + + SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + addition to 5V and GND). The connectivity between connectors A and B and + between C and D differs only in the chip select pin: + + MikroBUS A: MikroBUS B: + Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + ---- ------------ ------- ---- ------------ ------- + CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + + MikroBUS C: MikroBUS D: + Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + ---- ------------ ------- ---- ------------ ------- + CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + LEDs and Buttons ================ diff --git a/configs/flipnclick-pic32mz/include/board.h b/configs/flipnclick-pic32mz/include/board.h index 490a8cde3fb..0bcdc3dab16 100644 --- a/configs/flipnclick-pic32mz/include/board.h +++ b/configs/flipnclick-pic32mz/include/board.h @@ -303,6 +303,52 @@ #define BOARD_U5RX_PPS U5RXR_RPD14 #define BOARD_U5TX_PPS U5TX_RPD15R +/* SPI **********************************************************************/ +/* SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + * you would expect then. The SPI connector is configured as follows: + * + * Pin J1 Board Signal PIC32MZ + * --- -- ------------ ------- + * D10 8 SPI3_SCK RB14 + * D10 7 SPI3_MISO RB9 + * D11 6 SPI3_MOSI RB10 + * D13 5 SPI3_SS RB9 + * + * SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity between connectors A and B and + * between C and D differs only in the chip select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + * SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + * MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + * MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + * SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + * MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + * MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + * + * Chip select pin definitions are provided in + * configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h. + * + * CLK (output) pins have no alternative pin configurations. + */ + +#define BOARD_SDI1_PPS SDI1R_RPD2 +#define BOARD_SDO1_PPS SDO1_RPD3R + +#define BOARD_SDI2_PPS SDI2R_RPC4 +#define BOARD_SDO2_PPS SDO2_RPB5R + +#define BOARD_SDI3_PPS SDI3R_RPB9 +#define BOARD_SDO3_PPS SDO3_RPB9R + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h index a1cbc0a8ebc..ec514893eb4 100644 --- a/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h +++ b/configs/flipnclick-pic32mz/src/flipnclick-pic32mz.h @@ -85,6 +85,47 @@ #define GPIO_T1 (GPIO_INPUT | GPIO_INTERRUPT | GPIO_PORTD | GPIO_PIN10) #define GPIO_T2 (GPIO_INPUT | GPIO_INTERRUPT | GPIO_PORTD | GPIO_PIN11) +/* SPI Chip Selects + * + * SPI3 is available on pins D10-D13 of the Arduino Shield connectors where + * you would expect then. The SPI connector is configured as follows: + * + * Pin J1 Board Signal PIC32MZ + * --- -- ------------ ------- + * D10 8 SPI3_SCK RB14 + * D10 7 SPI3_MISO RB9 + * D11 6 SPI3_MOSI RB10 + * D13 5 SPI3_SS RB9 + */ + +#define GPIO_ARD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTB | GPIO_PIN14) + +/* SPI1 and SPI2 are also available on the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity between connectors A and B and + * between C and D differs only in the chip select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI2_SS1 RA0 CS SPI2_SS0 RE4 + * SCK SPI2_SCK RG6 SCK SPI2_SCK RG6 + * MISO SPI2_MISO RC4 MISO SPI2_MISO RC4 + * MOSI SPI2_MOSI RB5 MOSI SPI2_MOSI RB5 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal PIC32MZ Pin Board Signal PIC32MZ + * ---- ------------ ------- ---- ------------ ------- + * CS SPI1_SS0 RD12 CS SPI1_SS1 RD13 + * SCK SPI1_SCK RD1 SCK SPI1_SCK RD1 + * MISO SPI1_MISO RD2 MISO SPI1_MISO RD2 + * MOSI SPI1_MOSI RD3 MOSI SPI1_MOSI RD3 + */ + +#define GPIO_MBA_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTA | GPIO_PIN0) +#define GPIO_MBB_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | GPIO_PIN4) +#define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN12) +#define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | GPIO_PIN13) + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt index 8ab7a159a8f..6f286895058 100644 --- a/configs/flipnclick-sam3x/README.txt +++ b/configs/flipnclick-sam3x/README.txt @@ -14,6 +14,7 @@ Contents - STATUS - Buttons and LEDs - Serial Consoles + - SPI - Loading Code - Flip&Click SAM3X-specific Configuration Options - Configurations @@ -120,6 +121,39 @@ Serial Consoles in all configurations. But that is easily changed by modifying the configuration as described under "Configurations" below. +SPI +=== + + SPI0 is available on the Arduino compatible SPI connector (but no SPI is + available on pins D10-D13 of the main Arduino Shield connectors where + you might expect then). The SPI connector is configured as follows: + + Pin Board Signal SAM3X Pin Board Signal SAM3X + --- ------------ ----- --- ------------ ----- + 1 SPI0_MISO PA25 2 VCC-5V N/A + 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + 5 MRST NRSTB 6 GND N/A + + SPI0 is also available on each of the mikroBUS Click connectors (in + addition to 5V and GND). The connectivity differs only in the chip + select pin: + + MikroBUS A: MikroBUS B: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ----- + CS SPI0_CS0 PA28 CS PA29 PA29 + SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + + MikroBUS C: MikroBUS D: + Pin Board Signal SAM3X Pin Board Signal SAM3X + ---- ------------ ----- ---- ------------ ----- + CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + Loading Code ============ @@ -349,9 +383,10 @@ Loading Code You should be able to use a 10- to 20-pin adapter to connect a SAM-ICE or J-Link debugger to the Flip&Click SAM3X. I have this Olimex adapter: - https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . But so far I - have been unable to get the get the SAM-ICE to communicate with the - Flip&Click. + https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . I have been + loading code and debugging with no problems using JTAG. + + You can find photos my setup here: http://www.nuttx.org/doku.php?id=wiki:howtos:flipnclick-sam3x Flip&Click SAM3X-specific Configuration Options =============================================== diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h index 0e2b42fe5d0..dd72568d783 100644 --- a/configs/flipnclick-sam3x/include/board.h +++ b/configs/flipnclick-sam3x/include/board.h @@ -79,7 +79,7 @@ /* PLLA configuration. * * Divider = 1 - * Multipler = 14 + * Multiplier = 14 */ #define BOARD_CKGR_PLLAR_MUL (13 << PMC_CKGR_PLLAR_MUL_SHIFT) @@ -255,4 +255,44 @@ * There are no alternatives for these pins. */ +/* SPI: + * + * SPI0 is available on the Arduino compatible SPI connector (but no SPI is + * available on pins D10-D13 of the main Arduino Shield connectors where + * you might expect then). The SPI connector is configured as follows: + * + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * --- ------------ ----- --- ------------ ----- + * 1 SPI0_MISO PA25 2 VCC-5V N/A + * 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + * 5 MRST NRSTB 6 GND N/A + * + * SPI0 is also available on each of the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity differs only in the chip + * select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS0 PA28 CS PA29 PA29 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * Chip select pin definitions are provided in + * configs/flipnclick-sam3x/src/flipnclick-3x.h. + * + * There are no alternative pin selections for SPI0_MSIO and SPIO_MOSI. + */ + +#define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_1 + #endif /* __CONFIGS_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */ diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig index f0ba4aedf39..68e1421dc1c 100644 --- a/configs/flipnclick-sam3x/nsh/defconfig +++ b/configs/flipnclick-sam3x/nsh/defconfig @@ -9,9 +9,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_BOARD_LOOPSPERMSEC=6965 CONFIG_BUILTIN=y -CONFIG_DISABLE_ENVIRON=y -CONFIG_DISABLE_MOUNTPOINT=y -CONFIG_DISABLE_POLL=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y CONFIG_EXAMPLES_NSH=y CONFIG_FS_PROCFS=y @@ -23,6 +20,7 @@ CONFIG_MAX_WDOGPARMS=2 CONFIG_MM_REGIONS=3 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 @@ -40,7 +38,7 @@ CONFIG_SDCLONE_DISABLE=y CONFIG_START_DAY=28 CONFIG_START_MONTH=6 CONFIG_START_YEAR=2013 -CONFIG_TASK_NAME_SIZE=0 +CONFIG_TASK_NAME_SIZE=32 CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0 diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h index e35dacbe6d1..8887523ff73 100644 --- a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -79,6 +79,55 @@ #define GPIO_LED_D (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOC | GPIO_PIN8) +/* SPI chip select pins. + * + * SPI0 is available on the Arduino compatible SPI connector (but no SPI is + * available on pins D10-D13 of the main Arduino Shield connectors where + * you might expect then). The SPI connector is configured as follows: + * + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * --- ------------ ----- --- ------------ ----- + * 1 SPI0_MISO PA25 2 VCC-5V N/A + * 3 SPI0_SCK PA27 4 SPI0_MOSI PA26 + * 5 MRST NRSTB 6 GND N/A + * + * SPI0 is also available on each of the mikroBUS Click connectors (in + * addition to 5V and GND). The connectivity differs only in the chip + * select pin: + * + * MikroBUS A: MikroBUS B: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS0 PA28 CS PA29 PA29 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + * + * MikroBUS C: MikroBUS D: + * Pin Board Signal SAM3X Pin Board Signal SAM3X + * ---- ------------ ----- ---- ------------ ----- + * CS SPI0_CS2 PB21 CS SPI0_CS3 PB23 + * SCK SPI0_SCK PA27 SCK SPI0_SCK PA27 + * MISO SPI0_MISO PA25 MISO SPI0_MISO PA25 + * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 + */ + +#define GPIO_MBA_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN28) +#define MBA_CSNUM 0 + +#define GPIO_MBB_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN29) +#define MBB_CSNUM 1 + +#define GPIO_MBC_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOB | GPIO_PIN21) +#define MBC_CSNUM 2 + +#define GPIO_MBD_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOB | GPIO_PIN23) +#define MBD_CSNUM 3 + /************************************************************************************ * Public Types ************************************************************************************/