diff --git a/configs/spark/README.txt b/configs/spark/README.txt index 0759919c83..4ab81e270a 100644 --- a/configs/spark/README.txt +++ b/configs/spark/README.txt @@ -414,7 +414,6 @@ Hardware A1 JP1-11 PA[01] USART2_RTS/ADC12_IN1/TIM2_CH2 11 A0 JP1-12 PA[00] WKUP/USART2_CTS/ADC12_IN0/TIM2_CH1_ETR 10 - +3V3 JP2-1 V3.3 Out of Core NA RST JP2-2 NRST 7 VDDA JP2-3 ADC Voltage 9 @@ -486,7 +485,7 @@ Hardware LED_HEAPALLOCATE Heap has been allocated OFF ON OFF Blue LED_IRQSENABLED Interrupts enabled ON OFF ON Orange LED_STACKCREATED Idle stack created OFF OFF ON Green - LED_INIRQ In an interrupt** ON N/C N/C Red Glow + LED_INIRQ In an interrupt** ON N/C N/C Orange Glow LED_SIGNAL In a signal handler*** N/C ON N/C Blue Glow LED_ASSERTION An assertion failed ON ON ON White LED_PANIC The system has crashed ON N/C N/C Red Flashing diff --git a/configs/spark/src/spark.h b/configs/spark/src/spark.h index c729a679dd..2c95d7f9ac 100644 --- a/configs/spark/src/spark.h +++ b/configs/spark/src/spark.h @@ -176,7 +176,7 @@ #define GPIO_LED1 (GPIO_PORTA | GPIO_PIN13 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) #define GPIO_LED_USR GPIO_LED1 -#define GPIO_LED2 (GPIO_PORTA | GPIO_PIN8 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) +#define GPIO_LED2 (GPIO_PORTA | GPIO_PIN8 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) #define GPIO_LED3 (GPIO_PORTA | GPIO_PIN9 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) #define GPIO_LED4 (GPIO_PORTA | GPIO_PIN10 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) diff --git a/configs/spark/src/up_autoleds.c b/configs/spark/src/up_autoleds.c index b6d933de08..7f054cf1d0 100644 --- a/configs/spark/src/up_autoleds.c +++ b/configs/spark/src/up_autoleds.c @@ -189,12 +189,12 @@ static inline void phy_led_on(unsigned int on_bitset) if ((on_bitset & BOARD_RED_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED1, false); + stm32_gpiowrite(GPIO_LED2, false); } if ((on_bitset & BOARD_GREEN_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED2, false); + stm32_gpiowrite(GPIO_LED4, false); } if ((on_bitset & BOARD_BLUE_LED_BIT) != 0) @@ -206,7 +206,7 @@ static inline void phy_led_on(unsigned int on_bitset) if ((on_bitset & BOARD_USR_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED4, true); + stm32_gpiowrite(GPIO_LED1, true); } } @@ -224,12 +224,12 @@ static inline void phy_led_off(unsigned int off_bitset) if ((off_bitset & BOARD_RED_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED1, true); + stm32_gpiowrite(GPIO_LED2, true); } if ((off_bitset & BOARD_GREEN_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED2, true); + stm32_gpiowrite(GPIO_LED4, true); } if ((off_bitset & BOARD_BLUE_LED_BIT) != 0) @@ -241,7 +241,7 @@ static inline void phy_led_off(unsigned int off_bitset) if ((off_bitset & BOARD_USR_LED_BIT) != 0) { - stm32_gpiowrite(GPIO_LED4, false); + stm32_gpiowrite(GPIO_LED1, false); } } diff --git a/configs/spark/src/up_nsh.c b/configs/spark/src/up_nsh.c index a40ff57df7..6570fd5b02 100644 --- a/configs/spark/src/up_nsh.c +++ b/configs/spark/src/up_nsh.c @@ -159,15 +159,19 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n",CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Initializing SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); + spi = up_spiinitialize(CONFIG_SPARK_FLASH_SPI); if (!spi) { - message("nsh_archinitialize: ERROR: Failed to initialize SPI port %d\n",CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: ERROR: Failed to initialize SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n",CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Successfully initialized SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); /* Now bind the SPI interface to the SST25 SPI FLASH driver */ @@ -175,14 +179,45 @@ int nsh_archinitialize(void) mtd = sst25_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n", CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n", + CONFIG_SPARK_FLASH_SPI); } else { - message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n", CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n", + CONFIG_SPARK_FLASH_SPI); } -#ifdef CONFIG_SPARK_FLASH_PART +#ifndef CONFIG_SPARK_FLASH_PART + char partname[16]; + char mntpoint[16]; + + /* Use the FTL layer to wrap the MTD driver as a block driver */ + + ret = ftl_initialize(CONFIG_SPARK_FLASH_MINOR, mtd); + if (ret < 0) + { + fdbg("ERROR: Initialize the FTL layer\n"); + return ret; + } + + /* mount -t vfat /dev/mtdblock0 /mnt/p0 */ + + snprintf(partname, sizeof(partname), "/dev/mtdblock%d", + CONFIG_SPARK_FLASH_MINOR); + snprintf(mntpoint, sizeof(mntpoint)-1, CONFIG_SPARK_FLASH_MOUNT_POINT, + CONFIG_SPARK_FLASH_MINOR); + + /* Mount the file system at /mnt/pn */ + + ret = mount(partname, mntpoint, "vfat", 0, NULL); + if (ret < 0) + { + fdbg("ERROR: Failed to mount the FAT volume: %d\n", errno); + return ret; + } + +#else { int partno; int partsize; @@ -203,7 +238,7 @@ int nsh_archinitialize(void) /* Get the partition size */ partsize = atoi(ptr); - mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16); + mtd_part = mtd_partition(mtd, partoffset, (partsize >> 2) * 16); partoffset += (partsize >> 2) * 16; /* Use the FTL layer to wrap the MTD driver as a block driver */ @@ -216,7 +251,8 @@ int nsh_archinitialize(void) } snprintf(partname,sizeof(partname), "/dev/mtdblock%d", partno); - snprintf(mntpoint,sizeof(mntpoint)-1,CONFIG_SPARK_FLASH_MOUNT_POINT,partno); + snprintf(mntpoint,sizeof(mntpoint)-1, CONFIG_SPARK_FLASH_MOUNT_POINT, + partno); /* Mount the file system at /mnt/pn */