diff --git a/configs/mikroe-stm32f4/fulldemo/defconfig b/configs/mikroe-stm32f4/fulldemo/defconfig index 5aae84d478..cf2e58c028 100644 --- a/configs/mikroe-stm32f4/fulldemo/defconfig +++ b/configs/mikroe-stm32f4/fulldemo/defconfig @@ -16,7 +16,7 @@ CONFIG_HOST_LINUX=y # # Build Configuration # -CONFIG_APPS_DIR="../apps" +# CONFIG_APPS_DIR="../apps" # CONFIG_BUILD_2PASS is not set # @@ -39,7 +39,8 @@ CONFIG_RAW_BINARY=y # Debug Options # # CONFIG_DEBUG is not set -CONFIG_DEBUG_SYMBOLS=y +CONFIG_ARCH_HAVE_STACKCHECK=y +# CONFIG_DEBUG_SYMBOLS is not set # # System Type @@ -73,15 +74,24 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_LPC31XX is not set # CONFIG_ARCH_CHIP_LPC43XX is not set # CONFIG_ARCH_CHIP_NUC1XX is not set -# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_SAMA5 is not set +# CONFIG_ARCH_CHIP_SAM34 is not set CONFIG_ARCH_CHIP_STM32=y # CONFIG_ARCH_CHIP_STR71X is not set +# CONFIG_ARCH_ARM7TDMI is not set +# CONFIG_ARCH_ARM926EJS is not set +# CONFIG_ARCH_ARM920T is not set +# CONFIG_ARCH_CORTEXM0 is not set +# CONFIG_ARCH_CORTEXM3 is not set CONFIG_ARCH_CORTEXM4=y +# CONFIG_ARCH_CORTEXA5 is not set +# CONFIG_ARCH_CORTEXA8 is not set CONFIG_ARCH_FAMILY="armv7-m" CONFIG_ARCH_CHIP="stm32" # CONFIG_ARMV7M_USEBASEPRI is not set CONFIG_ARCH_HAVE_CMNVECTOR=y # CONFIG_ARMV7M_CMNVECTOR is not set +CONFIG_ARCH_HAVE_FPU=y # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set @@ -98,6 +108,24 @@ CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y # # STM32 Configuration Options # +# CONFIG_ARCH_CHIP_STM32L151C6 is not set +# CONFIG_ARCH_CHIP_STM32L151C8 is not set +# CONFIG_ARCH_CHIP_STM32L151CB is not set +# CONFIG_ARCH_CHIP_STM32L151R6 is not set +# CONFIG_ARCH_CHIP_STM32L151R8 is not set +# CONFIG_ARCH_CHIP_STM32L151RB is not set +# CONFIG_ARCH_CHIP_STM32L151V6 is not set +# CONFIG_ARCH_CHIP_STM32L151V8 is not set +# CONFIG_ARCH_CHIP_STM32L151VB is not set +# CONFIG_ARCH_CHIP_STM32L152C6 is not set +# CONFIG_ARCH_CHIP_STM32L152C8 is not set +# CONFIG_ARCH_CHIP_STM32L152CB is not set +# CONFIG_ARCH_CHIP_STM32L152R6 is not set +# CONFIG_ARCH_CHIP_STM32L152R8 is not set +# CONFIG_ARCH_CHIP_STM32L152RB is not set +# CONFIG_ARCH_CHIP_STM32L152V6 is not set +# CONFIG_ARCH_CHIP_STM32L152V8 is not set +# CONFIG_ARCH_CHIP_STM32L152VB is not set # CONFIG_ARCH_CHIP_STM32F100C8 is not set # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set @@ -110,6 +138,15 @@ CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y # CONFIG_ARCH_CHIP_STM32F100VC is not set # CONFIG_ARCH_CHIP_STM32F100VD is not set # CONFIG_ARCH_CHIP_STM32F100VE is not set +# CONFIG_ARCH_CHIP_STM32F103C4 is not set +# CONFIG_ARCH_CHIP_STM32F103C8 is not set +# CONFIG_ARCH_CHIP_STM32F103T8 is not set +# CONFIG_ARCH_CHIP_STM32F103TB is not set +# CONFIG_ARCH_CHIP_STM32F103CB is not set +# CONFIG_ARCH_CHIP_STM32F103R8 is not set +# CONFIG_ARCH_CHIP_STM32F103RB is not set +# CONFIG_ARCH_CHIP_STM32F103V8 is not set +# CONFIG_ARCH_CHIP_STM32F103VB is not set # CONFIG_ARCH_CHIP_STM32F103RET6 is not set # CONFIG_ARCH_CHIP_STM32F103VCT6 is not set # CONFIG_ARCH_CHIP_STM32F103VET6 is not set @@ -141,6 +178,17 @@ CONFIG_ARCH_CHIP_STM32F407VG=y # CONFIG_ARCH_CHIP_STM32F427V is not set # CONFIG_ARCH_CHIP_STM32F427Z is not set # CONFIG_ARCH_CHIP_STM32F427I is not set +# CONFIG_STM32_STM32L15XX is not set +# CONFIG_STM32_ENERGYLITE is not set +# CONFIG_STM32_STM32F10XX is not set +# CONFIG_STM32_VALUELINE is not set +# CONFIG_STM32_CONNECTIVITYLINE is not set +# CONFIG_STM32_PERFORMANCELINE is not set +# CONFIG_STM32_HIGHDENSITY is not set +# CONFIG_STM32_MEDIUMDENSITY is not set +# CONFIG_STM32_LOWDENSITY is not set +# CONFIG_STM32_STM32F20XX is not set +# CONFIG_STM32_STM32F30XX is not set CONFIG_STM32_STM32F40XX=y # CONFIG_STM32_DFU is not set @@ -156,7 +204,7 @@ CONFIG_STM32_ADC2=y # CONFIG_STM32_CCMDATARAM is not set # CONFIG_STM32_CRC is not set # CONFIG_STM32_CRYP is not set -# CONFIG_STM32_DMA1 is not set +CONFIG_STM32_DMA1=y # CONFIG_STM32_DMA2 is not set # CONFIG_STM32_DAC1 is not set # CONFIG_STM32_DAC2 is not set @@ -167,7 +215,6 @@ CONFIG_STM32_ADC2=y # CONFIG_STM32_I2C1 is not set # CONFIG_STM32_I2C2 is not set # CONFIG_STM32_I2C3 is not set -# CONFIG_STM32_IWDG is not set CONFIG_STM32_OTGFS=y # CONFIG_STM32_OTGHS is not set CONFIG_STM32_PWR=y @@ -197,6 +244,7 @@ CONFIG_STM32_USART2=y # CONFIG_STM32_UART4 is not set # CONFIG_STM32_UART5 is not set # CONFIG_STM32_USART6 is not set +# CONFIG_STM32_IWDG is not set # CONFIG_STM32_WWDG is not set CONFIG_STM32_ADC=y CONFIG_STM32_SPI=y @@ -213,6 +261,7 @@ CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y # CONFIG_STM32_FORCEPOWER is not set CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y # CONFIG_STM32_CCMEXCLUDE is not set +CONFIG_STM32_DMACAPABLE=y # CONFIG_STM32_TIM1_PWM is not set # CONFIG_STM32_TIM1_ADC is not set CONFIG_STM32_USART=y @@ -221,13 +270,15 @@ CONFIG_STM32_USART=y # U[S]ART Configuration # # CONFIG_USART2_RS485 is not set +# CONFIG_USART2_RXDMA is not set +# CONFIG_SERIAL_DISABLE_REORDERING is not set # CONFIG_STM32_USART_SINGLEWIRE is not set # # SPI Configuration # # CONFIG_STM32_SPI_INTERRUPTS is not set -# CONFIG_STM32_SPI_DMA is not set +CONFIG_STM32_SPI_DMA=y # # USB Host Configuration @@ -237,16 +288,12 @@ CONFIG_STM32_USART=y # USB Device Configuration # -# -# External Memory Configuration -# - # # Architecture Options # # CONFIG_ARCH_NOINTC is not set # CONFIG_ARCH_VECNOTIRQ is not set -# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_DMA=y CONFIG_ARCH_IRQPRIO=y # CONFIG_CUSTOM_STACK is not set # CONFIG_ADDRENV is not set @@ -262,8 +309,6 @@ CONFIG_ARCH_HAVE_RAMVECTORS=y # CONFIG_BOARD_LOOPSPERMSEC=16717 # CONFIG_ARCH_CALIBRATION is not set -CONFIG_RAM_START=0x20000000 -CONFIG_RAM_SIZE=114688 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y CONFIG_ARCH_INTERRUPTSTACK=0 @@ -276,6 +321,12 @@ CONFIG_BOOT_RUNFROMFLASH=y # CONFIG_BOOT_RUNFROMSDRAM is not set # CONFIG_BOOT_COPYTORAM is not set +# +# Boot Memory Configuration +# +CONFIG_RAM_START=0x20000000 +CONFIG_RAM_SIZE=114688 + # # Board Selection # @@ -324,7 +375,7 @@ CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set CONFIG_SCHED_ONEXIT=y CONFIG_SCHED_ONEXIT_MAX=4 -CONFIG_USER_ENTRYPOINT="nxwm_main" +CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_DISABLE_OS_API=y # CONFIG_DISABLE_CLOCK is not set # CONFIG_DISABLE_POSIX_TIMERS is not set @@ -383,24 +434,38 @@ CONFIG_SPI=y # CONFIG_SPI_OWNBUS is not set CONFIG_SPI_EXCHANGE=y # CONFIG_SPI_CMDDATA is not set +# CONFIG_SPI_BITBANG is not set CONFIG_RTC=y CONFIG_RTC_DATETIME=y CONFIG_RTC_ALARM=y # CONFIG_WATCHDOG is not set # CONFIG_ANALOG is not set +CONFIG_AUDIO_DEVICES=y +CONFIG_VS1053=y +CONFIG_VS1053_DEVICE_COUNT=1 # CONFIG_BCH is not set CONFIG_INPUT=y # CONFIG_INPUT_TSC2007 is not set # CONFIG_INPUT_ADS7843E is not set # CONFIG_INPUT_STMPE811 is not set CONFIG_LCD=y + +# +# Common LCD Settings +# # CONFIG_LCD_NOGETRUN is not set CONFIG_LCD_MAXCONTRAST=63 CONFIG_LCD_MAXPOWER=1 + +# +# Graphic LCD Devices +# # CONFIG_LCD_P14201 is not set # CONFIG_LCD_NOKIA6100 is not set CONFIG_LCD_MIO283QT2=y # CONFIG_LCD_UG9664HSWAG01 is not set +# CONFIG_LCD_UG2864HSWEG01 is not set +# CONFIG_LCD_UG2832HSWEG04 is not set # CONFIG_LCD_ST7567 is not set # CONFIG_LCD_UG2864AMBAG01 is not set # CONFIG_LCD_SSD1289 is not set @@ -408,6 +473,11 @@ CONFIG_LCD_LANDSCAPE=y # CONFIG_LCD_PORTRAIT is not set # CONFIG_LCD_RPORTRAIT is not set # CONFIG_LCD_RLANDSCAPE is not set + +# +# Alphanumeric/Segment LCD Devices +# +# CONFIG_LCD_LCD1602 is not set CONFIG_MMCSD=y CONFIG_MMCSD_NSLOTS=1 # CONFIG_MMCSD_READONLY is not set @@ -415,8 +485,9 @@ CONFIG_MMCSD_NSLOTS=1 CONFIG_MMCSD_MMCSUPPORT=y CONFIG_MMCSD_HAVECARDDETECT=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SPICLOCK=20000000 -# CONFIG_MMCSD_SDIO is not set +CONFIG_MMCSD_SPICLOCK=30000000 +CONFIG_MMCSD_SPIMODE=0 +# CONFIG_ARCH_HAVE_SDIO is not set CONFIG_MTD=y # @@ -434,6 +505,7 @@ CONFIG_RAMMTD_ERASESIZE=4096 CONFIG_RAMMTD_ERASESTATE=0xff # CONFIG_RAMMTD_FLASHSIM is not set # CONFIG_MTD_AT24XX is not set +# CONFIG_MTD_AT25 is not set # CONFIG_MTD_AT45DB is not set CONFIG_MTD_M25P=y CONFIG_M25P_SPIMODE=0 @@ -455,6 +527,11 @@ CONFIG_SERIAL=y CONFIG_SERIAL_REMOVABLE=y # CONFIG_16550_UART is not set CONFIG_ARCH_HAVE_USART2=y + +# +# USART Configuration +# +CONFIG_USART2_ISUART=y CONFIG_MCU_SERIAL=y CONFIG_STANDARD_SERIAL=y # CONFIG_USART2_SERIAL_CONSOLE is not set @@ -469,6 +546,10 @@ CONFIG_USART2_BAUD=115200 CONFIG_USART2_BITS=8 CONFIG_USART2_PARITY=0 CONFIG_USART2_2STOP=0 +# CONFIG_USART2_IFLOWCONTROL is not set +# CONFIG_USART2_OFLOWCONTROL is not set +# CONFIG_SERIAL_IFLOWCONTROL is not set +# CONFIG_SERIAL_OFLOWCONTROL is not set CONFIG_USBDEV=y # @@ -501,6 +582,7 @@ CONFIG_CDCACM_EPBULKIN_FSSIZE=64 CONFIG_CDCACM_EPBULKIN_HSSIZE=512 CONFIG_CDCACM_NWRREQS=4 CONFIG_CDCACM_NRDREQS=4 +CONFIG_CDCACM_BULKIN_REQLEN=96 CONFIG_CDCACM_RXBUFSIZE=256 CONFIG_CDCACM_TXBUFSIZE=256 CONFIG_CDCACM_VENDORID=0x0525 @@ -545,7 +627,7 @@ CONFIG_FS_SMARTFS=y CONFIG_SMARTFS_ERASEDSTATE=0xff CONFIG_SMARTFS_MAXNAMLEN=16 # CONFIG_SMARTFS_MULTI_ROOT_DIRS is not set -# CONFIG_FS_BINFS is not set +CONFIG_FS_BINFS=y # # System Logging @@ -648,6 +730,37 @@ CONFIG_NX_MXCLIENTMSGS=16 CONFIG_MM_REGIONS=2 # CONFIG_GRAN is not set +# +# Audio Support +# +CONFIG_AUDIO=y +# CONFIG_AUDIO_MULTI_SESSION is not set +# CONFIG_AUDIO_LARGE_BUFFERS is not set +CONFIG_AUDIO_NUM_BUFFERS=2 +CONFIG_AUDIO_BUFFER_NUMBYTES=8192 +# CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS is not set + +# +# Supported Audio Formats +# +# CONFIG_AUDIO_FORMAT_AC3 is not set +# CONFIG_AUDIO_FORMAT_DTS is not set +CONFIG_AUDIO_FORMAT_PCM=y +CONFIG_AUDIO_FORMAT_MP3=y +CONFIG_AUDIO_FORMAT_MIDI=y +# CONFIG_AUDIO_FORMAT_WMA is not set +# CONFIG_AUDIO_FORMAT_OGG_VORBIS is not set + +# +# Exclude Specific Audio Features +# +# CONFIG_AUDIO_EXCLUDE_VOLUME is not set +# CONFIG_AUDIO_EXCLUDE_BALANCE is not set +# CONFIG_AUDIO_EXCLUDE_TONE is not set +# CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME is not set +# CONFIG_AUDIO_EXCLUDE_STOP is not set +# CONFIG_AUDIO_CUSTOM_DEV_PATH is not set + # # Binary Formats # @@ -699,6 +812,7 @@ CONFIG_SCHED_WORKPERIOD=20000 CONFIG_SCHED_WORKSTACKSIZE=2048 # CONFIG_SCHED_LPWORK is not set # CONFIG_LIB_KBDCODEC is not set +# CONFIG_LIB_SLCDCODEC is not set # # Basic CXX Support @@ -727,8 +841,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # # CONFIG_EXAMPLES_BUTTONS is not set # CONFIG_EXAMPLES_CAN is not set -# CONFIG_SYSTEM_CDCACM is not set -# CONFIG_SYSTEM_COMPOSITE is not set # CONFIG_EXAMPLES_CXXTEST is not set # CONFIG_EXAMPLES_DHCPD is not set # CONFIG_EXAMPLES_ELF is not set @@ -745,6 +857,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # CONFIG_EXAMPLES_MODBUS is not set # CONFIG_EXAMPLES_MOUNT is not set # CONFIG_EXAMPLES_MTDPART is not set +# CONFIG_EXAMPLES_NRF24L01TERM is not set CONFIG_EXAMPLES_NSH=y CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y # CONFIG_EXAMPLES_NULL is not set @@ -769,7 +882,7 @@ CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 # CONFIG_EXAMPLES_NXFFS is not set # CONFIG_EXAMPLES_NXFLAT is not set # CONFIG_EXAMPLES_NXHELLO is not set -CONFIG_EXAMPLES_NXIMAGE=y +# CONFIG_EXAMPLES_NXIMAGE is not set # CONFIG_EXAMPLES_NXLINES is not set # CONFIG_EXAMPLES_NXTEXT is not set # CONFIG_EXAMPLES_OSTEST is not set @@ -781,9 +894,11 @@ CONFIG_EXAMPLES_NXIMAGE=y # CONFIG_EXAMPLES_ROMFS is not set # CONFIG_EXAMPLES_SENDMAIL is not set # CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_SLCD is not set # CONFIG_EXAMPLES_FLASH_TEST is not set # CONFIG_EXAMPLES_SMART_TEST is not set # CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_TCPECHO is not set # CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set @@ -793,7 +908,6 @@ CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" # CONFIG_EXAMPLES_UDP is not set # CONFIG_EXAMPLES_UIP is not set # CONFIG_EXAMPLES_USBSERIAL is not set -# CONFIG_SYSTEM_USBMSC is not set # CONFIG_EXAMPLES_USBTERM is not set # CONFIG_EXAMPLES_WATCHDOG is not set @@ -843,10 +957,13 @@ CONFIG_NSH_BUILTIN_APPS=y # # Disable Individual commands # +# CONFIG_NSH_DISABLE_ADDROUTE is not set # CONFIG_NSH_DISABLE_CAT is not set # CONFIG_NSH_DISABLE_CD is not set # CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_CMP is not set # CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_DELROUTE is not set # CONFIG_NSH_DISABLE_ECHO is not set # CONFIG_NSH_DISABLE_EXEC is not set # CONFIG_NSH_DISABLE_EXIT is not set @@ -891,6 +1008,7 @@ CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=y CONFIG_NSH_LINELEN=64 +CONFIG_NSH_MAXARGUMENTS=6 CONFIG_NSH_NESTDEPTH=3 # CONFIG_NSH_DISABLESCRIPT is not set # CONFIG_NSH_DISABLEBG is not set @@ -1060,6 +1178,15 @@ CONFIG_NXWM_MEDIAPLAYER=y # System NSH Add-Ons # +# +# USB CDC/ACM Device Commands +# +# CONFIG_SYSTEM_CDCACM is not set + +# +# USB Composite Device Commands +# + # # Custom Free Memory Command # @@ -1079,6 +1206,26 @@ CONFIG_NXWM_MEDIAPLAYER=y # CONFIG_SYSTEM_FLASH_ERASEALL=y +# +# NxPlayer media player library / command Line +# +CONFIG_SYSTEM_NXPLAYER=y +CONFIG_NXPLAYER_COMMAND_LINE=y +CONFIG_NXPLAYER_INCLUDE_HELP=y +CONFIG_NXPLAYER_INCLUDE_DEVICE_SEARCH=y +# CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE is not set +CONFIG_NXPLAYER_FMT_FROM_EXT=y +# CONFIG_NXPLAYER_FMT_FROM_HEADER is not set +CONFIG_NXPLAYER_INCLUDE_MEDIADIR=y +CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/usr/share/sounds" +# CONFIG_NXPLAYER_RECURSIVE_MEDIA_SEARCH is not set +CONFIG_NXPLAYER_INCLUDE_SYSTEM_RESET=y + +# +# RAM test +# +# CONFIG_SYSTEM_RAMTEST is not set + # # readline() # @@ -1108,3 +1255,16 @@ CONFIG_SYSTEM_SYSINFO=y # # USB Monitor # + +# +# Stack Monitor +# + +# +# USB Mass Storage Device Commands +# + +# +# Zmodem Commands +# +# CONFIG_SYSTEM_ZMODEM is not set diff --git a/configs/mikroe-stm32f4/include/board.h b/configs/mikroe-stm32f4/include/board.h index 4ddbe9efc9..7728f70618 100644 --- a/configs/mikroe-stm32f4/include/board.h +++ b/configs/mikroe-stm32f4/include/board.h @@ -234,10 +234,14 @@ #define GPIO_SPI2_MISO GPIO_SPI3_MISO_2 #define GPIO_SPI2_MOSI GPIO_SPI3_MOSI_2 #define GPIO_SPI2_SCK GPIO_SPI3_SCK_2 +#define DMACHAN_SPI2_RX DMAMAP_SPI2_RX +#define DMACHAN_SPI2_TX DMAMAP_SPI2_TX #define GPIO_SPI3_MISO GPIO_SPI3_MISO_2 #define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_2 #define GPIO_SPI3_SCK GPIO_SPI3_SCK_2 +#define DMACHAN_SPI3_RX DMAMAP_SPI3_RX_2 +#define DMACHAN_SPI3_TX DMAMAP_SPI3_TX_2 /* Timer Inputs/Outputs (see the README.txt file for options) */ diff --git a/configs/mikroe-stm32f4/src/mikroe-stm32f4-internal.h b/configs/mikroe-stm32f4/src/mikroe-stm32f4-internal.h index c27306048a..e97b5bdabe 100644 --- a/configs/mikroe-stm32f4/src/mikroe-stm32f4-internal.h +++ b/configs/mikroe-stm32f4/src/mikroe-stm32f4-internal.h @@ -189,6 +189,7 @@ #define GPIO_VS1053_RST (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN7) #define GPIO_VS1053_DREQ (GPIO_INPUT|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN6) +#define GPIO_VS1053_DREQ_IRQ STM32_IRQ_EXTI95 /**************************************************************************************************** * Public Types diff --git a/configs/mikroe-stm32f4/src/up_boot.c b/configs/mikroe-stm32f4/src/up_boot.c index bbdd435c7f..de73f66c6f 100644 --- a/configs/mikroe-stm32f4/src/up_boot.c +++ b/configs/mikroe-stm32f4/src/up_boot.c @@ -71,6 +71,12 @@ void stm32_boardinitialize(void) { + /* First reset the VS1053 since it tends to produce noise out of power on reset */ + +#ifdef CONFIG_VS1053 + (void)stm32_configgpio(GPIO_VS1053_RST); +#endif + /* Configure GPIOs for controlling the LCD */ #ifdef CONFIG_LCD_MIO283QT2 diff --git a/configs/mikroe-stm32f4/src/up_spi.c b/configs/mikroe-stm32f4/src/up_spi.c index d13b946230..bf20c001d0 100644 --- a/configs/mikroe-stm32f4/src/up_spi.c +++ b/configs/mikroe-stm32f4/src/up_spi.c @@ -104,25 +104,20 @@ void weak_function stm32_spiinitialize(void) #ifdef CONFIG_MTD_M25P (void)stm32_configgpio(GPIO_CS_FLASH); /* FLASH chip select */ - stm32_gpiowrite(GPIO_CS_FLASH, 1); /* Ensure the CS is inactive */ #endif #if defined(CONFIG_MMCSD) (void)stm32_configgpio(GPIO_CS_MMCSD); /* MMC/SD chip select */ (void)stm32_configgpio(GPIO_SD_CD); /* MMC/SD card detect */ - stm32_gpiowrite(GPIO_CS_MMCSD, 1); /* Ensure the CS is inactive */ #endif -#ifdef CONFIG_AUDIO_MP3_CODEC +#ifdef CONFIG_VS1053 (void)stm32_configgpio(GPIO_CS_MP3_DATA); /* MP3 codec chip select for DATA */ (void)stm32_configgpio(GPIO_CS_MP3_CMD); /* MP3 codec chip select for CMD */ - stm32_gpiowrite(GPIO_CS_MP3_DATA, 1); /* Ensure the CS is inactive */ - stm32_gpiowrite(GPIO_CS_MP3_CMD, 1); /* Ensure the CS is inactive */ #endif /* Configure the EXP I/O cs for SPI3 */ (void)stm32_configgpio(GPIO_CS_EXP_SPI3); /* Expander chip select */ - stm32_gpiowrite(GPIO_CS_EXP_SPI3, 1); /* Ensure the CS is inactive */ #endif } @@ -155,12 +150,17 @@ void weak_function stm32_spiinitialize(void) #ifdef CONFIG_STM32_SPI3 void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { - spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#if defined(CONFIG_MTD_M25P) - if (devid == SPIDEV_FLASH) + spivdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); + +#if defined(CONFIG_VS1053) + if (devid == SPIDEV_AUDIO_DATA) { - stm32_gpiowrite(GPIO_CS_FLASH, !selected); + stm32_gpiowrite(GPIO_CS_MP3_DATA, !selected); + } + else if (devid == SPIDEV_AUDIO_CTRL) + { + stm32_gpiowrite(GPIO_CS_MP3_CMD, !selected); } else #endif @@ -173,19 +173,14 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele else #endif -#if defined(CONFIG_AUDIO_MP3_CODEC) - if (devid == SPIDEV_AUDIO_DATA) +#if defined(CONFIG_MTD_M25P) + if (devid == SPIDEV_FLASH) { - stm32_gpiowrite(GPIO_CS_MP3_DATA, !selected); - } - else if (devid == SPIDEV_AUDIO_CTRL) - { - stm32_gpiowrite(GPIO_CS_MP3_CMD, !selected); + stm32_gpiowrite(GPIO_CS_FLASH, !selected); } else - #endif - + /* Must be the expansion header device */ if (devid == SPIDEV_EXPANDER) @@ -285,4 +280,3 @@ int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) #endif /* CONFIG_SPI_CMDDATA */ #endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */ - diff --git a/configs/mikroe-stm32f4/src/up_vs1053.c b/configs/mikroe-stm32f4/src/up_vs1053.c index b4a55c45a1..8fc43482b6 100644 --- a/configs/mikroe-stm32f4/src/up_vs1053.c +++ b/configs/mikroe-stm32f4/src/up_vs1053.c @@ -88,6 +88,7 @@ static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler); static void up_enable(FAR const struct vs1053_lower_s *lower); static void up_disable(FAR const struct vs1053_lower_s *lower); static void up_reset(FAR const struct vs1053_lower_s *lower, bool state); +static int up_read_dreq(FAR const struct vs1053_lower_s *lower); /**************************************************************************** * Private Data @@ -97,17 +98,18 @@ static void up_reset(FAR const struct vs1053_lower_s *lower, bool state); * following structure provides an MCU-independent mechanixm for controlling * the VS1053 GPIO interrupt. */ - static struct stm32_lower_s g_vs1053lower = { .lower = { - .attach = up_attach, - .enable = up_enable, - .disable = up_disable, - .reset = up_reset + .attach = up_attach, + .enable = up_enable, + .disable = up_disable, + .reset = up_reset, + .read_dreq = up_read_dreq, + .irq = GPIO_VS1053_DREQ_IRQ }, - .handler = NULL, + .handler = NULL, }; /**************************************************************************** @@ -122,10 +124,8 @@ static int up_attach(FAR const struct vs1053_lower_s *lower, xcpt_t handler) { FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; - /* Just save the handler for use when the interrupt is enabled */ - - priv->handler = handler; - return OK; + priv->handler = handler; /* Save the handler for later */ + return 0; } static void up_enable(FAR const struct vs1053_lower_s *lower) @@ -133,12 +133,12 @@ static void up_enable(FAR const struct vs1053_lower_s *lower) FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower; DEBUGASSERT(priv->handler); - (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, true, true, priv->handler); + (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, true, false, false, priv->handler); } static void up_disable(FAR const struct vs1053_lower_s *lower) { - (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, true, true, NULL); + (void)stm32_gpiosetevent(GPIO_VS1053_DREQ, false, false, false, NULL); } static void up_reset(FAR const struct vs1053_lower_s *lower, bool state) @@ -146,6 +146,11 @@ static void up_reset(FAR const struct vs1053_lower_s *lower, bool state) stm32_gpiowrite(GPIO_VS1053_RST, state); } +static int up_read_dreq(FAR const struct vs1053_lower_s *lower) +{ + return stm32_gpioread(GPIO_VS1053_DREQ); +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -157,43 +162,44 @@ static void up_reset(FAR const struct vs1053_lower_s *lower, bool state) void up_vs1053initialize(FAR struct spi_dev_s* spi) { int ret; - int x; char name[8]; FAR struct audio_lowerhalf_s *pVs1053; /* Assumptions: * 1) SPI pins were configured in up_spi.c early in the boot-up phase. - * 2) Clocking for the SPI1 peripheral was also provided earlier in boot-up. + * 2) Clocking for the SPI3 peripheral was also provided earlier in boot-up. */ - /* Take VS1053 out of reset (active low)*/ + /* NOTE: The RST line should be asserted early in the boot process + * during the boardinitialize function because the VS1053 + * generates a low frequency humming noise from power-on reset + * until the RST line is asserted. + */ - (void)stm32_configgpio(GPIO_VS1053_RST); - (void)stm32_configgpio(GPIO_VS1053_DREQ); + //(void)stm32_configgpio(GPIO_VS1053_RST); - stm32_gpiowrite(GPIO_VS1053_RST, 0); - for (x = 0; x < 10000; x++); - stm32_gpiowrite(GPIO_VS1053_RST, 1); + /* Initialize the VS1053 DREQ GPIO line */ + + (void)stm32_configgpio(GPIO_VS1053_DREQ); /* Bind the SPI port to the VS1053 driver */ pVs1053 = vs1053_initialize(spi, &g_vs1053lower.lower, VS1053_DEVNO); - if (ret < 0) + if (pVs1053 == NULL) { - audlldbg("Failed to bind SPI port %d VS1053 device: %d\n", - VS1053_DEVNO, ret); + audlldbg("Failed to bind SPI port %d VS1053 device\n", VS1053_DEVNO); return; } /* Now register the audio device */ - sprintf(name, "mp3%d", VS1053_DEVNO); + sprintf(name, "vs1053d%d", VS1053_DEVNO); ret = audio_register(name, pVs1053); if (ret < 0) { auddbg("up_vs1053initialize: Failed to register VS1053 Audio device\n"); } - + audllvdbg("Bound SPI port to VS1053 device %s\n", name); }