8000 stmhal: I2S (Inter-IC-Sound) peripheral support for pyb module by blmorris · Pull Request #1361 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stmhal: I2S (Inter-IC-Sound) peripheral support for pyb module #1361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0535bb9
stmhal/pin_named_pins.c: Add pin_find_af_type function
blmorris Jul 7, 2015
367d678
stmhal/boards: Configuration files for Myriad2 audio processing board
blmorris Jul 2, 2015
befe4db
stmhal/boards/STM32F4DISC: Fix mpconfigboard.h and pins.h so that build
blmorris Jul 2, 2015
e8f6cc7
stmhal/i2s.c: Add macro guards to prevent i2s.c from compiling
blmorris Jul 6, 2015
bd48a82
stmhal/boards/PYBV10/mpconfigboard.h: Enable I2S3 (for testing only)
blmorris Jul 14, 2015
6a0a8fc
stmhal/pin_defs_stmhal.h: Add comment for a minor fix
blmorris Jul 14, 2015
e441993
stmhal/i2s.c: Redesign pin configuration to eliminate hard-coded pin …
blmorris Jul 14, 2015
efa4052
stmhal/i2s.c: Clean out unused codeafter refactor
blmorris Jul 14, 2015
af5d8eb
stmhal/Makfile: Restore entries for HAL I2S files.
blmorris Jul 21, 2015
503e7f1
stmhal: STM32F4DISC: Enable HAL I2S module
blmorris Jul 23, 2015
7cb8464
stmhal: i2s: Rework parameter configuration to use more builtin const…
blmorris Jul 27, 2015
5a94b80
stmhal/i2s.c: Change pyb_i2s_print function so that text matches kwar…
blmorris Jul 27, 2015
ab3d933
stmhal/i2s.c: Adjust parameter initialization and update comments
blmorris Jul 28, 2015
c57c9e3
stmhal/boards/MYRIAD2: Update built files for MYRIAD2
blmorris Aug 18, 2015
90907ac
stmhal/i2s.c: Add stub methods more i2s.stream_out and stream_in
blmorris Aug 19, 2015
d7fb034
stmhal/i2s.c: First commit with (semi-)working stream_out function
blmorris Aug 21, 2015
4cf0c21
stmhal/i2s.c: Whitespace cleanup and untabify
blmorris Aug 24, 2015
f0489a0
stmhal/i2s.c: I2S stream_out function working, not crashing uPy anymore
blmorris Aug 25, 2015
9d1b8d1
stmhal/i2s.c: Add DMA pause, resume, stop methods.
blmorris Aug 26, 2015
d3c4b87
stmhal/i2s.c: Small cleanup, add comment re: HAL_I2S_DMAStop not working
blmorris Aug 27, 2015
c53e15f
stmhal/i2s.c: Update buffer-oriented methods to move DMA handles
blmorris Aug 27, 2015
561e9fb
stmhal/i2s.c: Fix broken i2s.stop() function; stop stream_out transfer
blmorris Sep 14, 2015
12d7a08
stmhal/i2s.c: Get DMA init synchronized with I2S clock; now seems to …
blmorris Sep 17, 2015
2352620
stmhal/i2s.c: Use new mp_is_nonblocking_error from stream.h
blmorris Oct 19, 2015
d29d45a
stmhal/i2s.c: Refactor a few common checks into inline functions
blmorris Oct 19, 2015
d219b97
stmhal/i2s.c: Lots of small changes on the way to getting stream_in a…
blmorris Oct 21, 2015
1816081
stmhal/i2s.c: First commit with operational stream_in() function!
blmorris Oct 23, 2015
0e00877
stmhal/i2s.c: stream_in(f) and stream_out(f) functions both working.
blmorris Oct 27, 2015
abd534e
stmhal/i2s.c: Initial implementation of 'len' arg to stream_in/_out
blmorris Nov 3, 2015
0622ae1
stmhal/i2s.c: Replace #include MICROPY_HAL_H with "py/mphal.h"
blmorris Nov 3, 2015
c5ff1fd
stmhal/i2s.c: Update internal stream read and write methods
blmorris Nov 5, 2015
2800864
stmhal/i2s.c: Milestone - basic streaming functionality is working
blmorris Nov 9, 2015
cd55569
Enable Hardfault handler output for debugging
blmorris Dec 1, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stmhal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ SRC_C = \
servo.c \
dac.c \
adc.c \
i2s.c \
$(wildcard boards/$(BOARD)/*.c)

SRC_O = \
Expand All @@ -181,6 +182,8 @@ SRC_HAL = $(addprefix $(HAL_DIR)/src/stm32$(MCU_SERIES)xx_,\
hal_flash_ex.c \
hal_gpio.c \
hal_i2c.c \
hal_i2s.c \
hal_i2s_ex.c \
hal_pcd.c \
hal_pcd_ex.c \
hal_pwr.c \
Expand Down
70 changes: 70 additions & 0 deletions stmhal/boards/MYRIAD2/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#define MICROPY_HW_BOARD_NAME "Myriad2"
#define MICROPY_HW_MCU_NAME "STM32F405RG"
#define MICROPY_PY_SYS_PLATFORM "pyboard"

#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_SDCARD (1)
#define MICROPY_HW_HAS_MMA7660 (0) //blm
#define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (0) //blm
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1)
#define MICROPY_HW_ENABLE_SERVO (0) //blm
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI2 (1)
#define MICROPY_HW_ENABLE_SPI3 (0)
#define MICROPY_HW_ENABLE_CAN (0) //blm
#define MICROPY_HW_ENABLE_I2S2 (1)
#define MICROPY_HW_ENABLE_I2S3 (0)

// HSE is 24MHz
#define MICROPY_HW_CLK_PLLM (24)
#define MICROPY_HW_CLK_PLLN (336)
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
#define MICROPY_HW_CLK_PLLQ (7)

// The pyboard has a 32kHz crystal for the RTC
#define MICROPY_HW_RTC_USE_LSE (1)

// UART config
#define MICROPY_HW_UART1_NAME "XB"
#define MICROPY_HW_UART1_PORT (GPIOB)
#define MICROPY_HW_UART1_PINS (GPIO_PIN_6 | GPIO_PIN_7)
#define MICROPY_HW_UART4_NAME "XA"
#define MICROPY_HW_UART4_PORT (GPIOA)
#define MICROPY_HW_UART4_PINS (GPIO_PIN_0 | GPIO_PIN_1)

// I2C busses
#define MICROPY_HW_I2C1_NAME "X"
#define MICROPY_HW_I2C1_SCL (pin_B6)
#define MICROPY_HW_I2C1_SDA (pin_B7)

// SPI busses - enabled but not really available on Myriad
#define MICROPY_HW_SPI1_NAME "X"
#define MICROPY_HW_SPI2_NAME "Y"

// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_A13)
#define MICROPY_HW_USRSW_PULL (GPIO_PULLUP)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)

// The Myriad2 has 4 LEDs
#define MICROPY_HW_LED1 (pin_C4) // LED1
#define MICROPY_HW_LED2 (pin_C5) // LED2
#define MICROPY_HW_LED3 (pin_B5) // red
#define MICROPY_HW_LED4 (pin_B4) // green
#define MICROPY_HW_LED_OTYPE (GPIO_MODE_OUTPUT_OD)
#define MICROPY_HW_LED_ON(pin) (pin->gpio->BSRRH = pin->pin_mask)
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->BSRRL = pin->pin_mask)

// SD card detect switch
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8)
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)

// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
4 changes: 4 additions & 0 deletions stmhal/boards/MYRIAD2/mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F405xx
AF_FILE = boards/stm32f405_af.csv
LD_FILE = boards/stm32f405.ld
59 changes: 59 additions & 0 deletions stmhal/boards/MYRIAD2/pins.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
X1,PA0
X2,PA1
X3,PA2
X4,PA3
X5,PA4
X6,PA5
X7,PA6
X8,PA7
X9,PB6
X10,PB7
X11,PC4
X12,PC5
X13,Reset
X14,GND
X15,3.3V
X16,VIN
X17,PB3
X18,PC13
X19,PC0
X20,PC1
X21,PC2
X22,PC3
X23,A3.3V
X24,AGND
Y1,PC6
Y2,PC7
Y3,PB8
Y4,PB9
Y5,PB12
Y6,PB13
Y7,PB14
Y8,PB15
Y9,PB10
Y10,PB11
Y11,PB0
Y12,PB1
Y13,Reset
Y14,GND
Y15,3.3V
Y16,VIN
LED1,PC4
LED2,PC5
LED3,PB5
LED4,PB4
SW,PA13
MMA_INT,PB2
MMA_AVDD,PB5
SD_D0,PC8
SD_D1,PC9
SD_D2,PC10
SD_D3,PC11
SD_CMD,PD2
SD_CK,PC12
SD,PA8
SD_SW,PA8
USB_VBUS,PA9
USB_ID,PA10
USB_DM,PA11
USB_DP,PA12
Loading
0