Commit Graph

99 Commits

Author SHA1 Message Date
Dave Hylands
32b7e93535 stmhal: NUCLEO 401 - Add definitions for I2C2 and I2C3 2016-02-10 21:26:14 -08:00
Dave Hylands
f791e14750 stmhal: CERB40 - Add pins defines for I2C3 2016-02-10 21:25:30 -08:00
Dave Hylands
38ac23c942 stmhal: NUCLEO 401 - Add a bunch of missing pins and reorder the pins
This groups the pins for a port together and puts them in numerical
order. It also adds ARDUINO pin names.
2016-02-10 21:23:45 -08:00
Dave Hylands
a888d5ab91 stmhal: Improve NUCLEO-F401RE build, with UART2 as REPL.
This enables MICROPY_HW_HAS_FLASH which got missed.

The HW has UART2 on the 401 connected to the STLINK procesor
which exposes it as USB serial. This connects that up so that
you can get a REPL using the USB serial.
2016-02-10 16:50:05 +00:00
Paul Sokolovsky
97a0846af9 stmhal/diskio: Introduce MICROPY_HW_HAS_FLASH setting.
To allow to reuse stmhal/diskio for ports which don't have flash but have
other storage devices.
2016-02-06 15:07:01 +02:00
Damien George
a8a4b01af6 stmhal: Add PWM capability for LED(3) and LED(4) on pyboards.
USB CDC no longer needs TIM3 (which was originally used for LED(4) PWM)
and so TIM3 has been freed for general purpose use by the user.  Hence
LED(4) lost its PWM capabilities.

This patch reinstates the PWM capabilities using a semi-generic piece
of code which allows to configure a timer and PWM channel to use for any
LED.  But the PWM capability is only configured if the LED is set to an
intensity between 1 and 254 (ie only when needed).  In that case the
relevant timer is configured for PWM.  It's up to the user to make sure
the timers are not used if PWM is active.

This patch also makes sure that PWM LEDs are turned off using standard
GPIO when calling led.off() or led.intensity(0), instead of just setting
the PWM counter to zero.
2016-01-29 22:44:43 +00:00
Damien George
ea89b80ff4 stmhal: Make TIM3 available for use by the user.
TIM3 is no longer used by USB CDC for triggering outgoing data, so we
can now make it available to the user.

PWM fading on LED(4) is now gone, but will be reinstated in a new way.
2016-01-29 22:31:56 +00:00
Carmine Noviello
3d42aa07dd stmhal: Add support for the STM32F401NUCLEO board.
Includes full version of pins.csv file with correct mapping of the Nucleo
STM32F401RE chip (LQFP64 package).
2016-01-27 12:30:36 +00:00
Fabian
d0f31ccf33 stmhal: Change PLL configuration for STM32F7DISC.
Changes USB clock from 50MHz to 48MHz which improves USB communication.
2015-12-18 22:16:49 +00:00
Tobias Badertscher
c5d8ffef58 stmhal: Extend SPI support to fully support all SPI devices on STM32F429.
This includes SPI4, SPI5 and SPI6.
2015-12-16 00:38:36 +00:00
Damien George
f7c4f9a640 stmhal: For SPI config, use HW_SPIx_SCK instead of HW_ENABLE_SPIx.
Previously, SPI was configured by a board defining MICROPY_HW_ENABLE_SPIx
to 0 or 1.  Now, the board should define MICROPY_HW_SPIx_SCK, MISO, MOSI
and NSS.  This makes it the same as how I2C is configured.
2015-12-12 15:02:02 +00:00
neilh10
1be0fde45c stmhal: Enable two USB phys to be supported together.
This is refactoring to enable support for the two USB PHYs available on
some STM32F4 processors to be used at the same time. The F405/7 & F429
have two USB PHYs, others such as the F411 only have one PHY.

This has been tested separately on a pyb10 (USB_FS PHY) and F429DISC
(USB_HS PHY) to be able to invoke a REPL/USB.  I have modified a PYBV10
to support two PHYs.

The long term objective is to support a 2nd USB PHY to be brought up as a
USB HOST, and possibly a single USB PHY to be OTG.
2015-12-09 09:56:36 +00:00
Damien George
66b96822fb stmhal: Add option to free up TIM3 from USB VCP polling.
This is a hack to free up TIM3 so that it can be used by the user.
Instead we use the PVD irq to call the USB VCP polling function, and
trigger it from SysTick (so SysTick itself does not do any processing).

The feature is enabled for pyboard lite only, since it lacks timers.
2015-12-04 14:07:15 +00:00
Damien George
e9a684d741 stmhal: Add board config files for PYBv1.1 and PYBLITEv1.0. 2015-12-02 12:47:09 +00:00
Dave Hylands
061eb6fa6b stmahl: Fix usbd_conf.c for devices which don't have USB_HS at all.
The STMCube examples define both USE_USB_HS and USE_USB_HS_IN_FS when they
use the HS in FS mode.

The STM32F401 doesn't have a USB_HS at all, so the USB_OTG_HS instance
doesn't even exist.
2015-11-26 16:17:26 +00:00
Tobias Badertscher
8844d031e4 stmhal: Add support for the STM32F429I-DISCO kit by STMicro. 2015-11-25 23:53:26 +00:00
T S
86aa16bea6 stmhal: Implement delayed RTC initialization with LSI fallback.
If RTC is already running at boot then it's left alone.  Otherwise, RTC is
started at boot but startup function returns straight away.  RTC startup
is then finished the first time it is used.  Fallback to LSI if LSE fails
to start in a certain time.

Also included:
 MICROPY_HW_CLK_LAST_FREQ
        hold pyb.freq() parameters in RTC backup reg
 MICROPY_HW_RTC_USE_US
        option to present datetime sub-seconds in microseconds
 MICROPY_HW_RTC_USE_CALOUT
        option to enable RTC calibration output

CLK_LAST_FREQ and RTC_USE_CALOUT are enabled for PYBv1.0.
2015-11-23 23:23:07 +00:00
Damien George
731f359292 all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such
as stdio and delay/ticks, which ports should provide definitions for.  A
port will also provide mphalport.h with further HAL declarations.
2015-10-31 19:14:30 +03:00
Damien George
f705cb5f7a stmhal: Update PYBv3 and PYBv4 pin defs to include MMA pins, and others. 2015-10-31 11:14:15 +00:00
Dave Hylands
823a961ecc stmhal: Enable sdcard on STM32F7DISC board. 2015-10-30 12:05:14 +00:00
Damien George
6f70283909 stmhal: Make accel AVDD pin configurable via mpconfigboard.h. 2015-10-29 22:40:42 +00:00
Bob Clough
86e6ad76cb stmhal: Add support for STM32F411 Discovery Board (STM32F411E-DISCO). 2015-08-29 22:50:58 +01:00
tobbad
1abb449dfb stmhal: Fixed some typos in stm32f411_af.csv. 2015-08-17 16:51:19 +01:00
Dave Hylands
872f9af6ae stmhal: Use CMSIS_MCU definition from mpconfigboard.mk
This needs to land afte #1407 lands, since #1407 is where
the CMSIS_MCU was defined.
2015-08-07 08:54:14 +01:00
Dave Hylands
be66a9ecf6 stmhal: Generate modstm constants per build
This causes unnecessary constants to no longer be generated.
Some constants (like UART_BRR) are different between the F4 and F7
2015-08-07 08:46:43 +01:00
Dave Hylands
5e11d2b349 stmhal: Enable SPI support for F7 MCUs. 2015-08-05 23:38:49 +01:00
Dave Hylands
34fe5a30c6 stmhal: Enable I2C support for F7 MCUs. 2015-08-05 23:38:24 +01:00
Dave Hylands
8f1eced69d stmhal: Add STM32F7 support for USB serial and storage.
USB serial is now working for F7.

Internal file storage is now working for F7.  The flash is laid out a bit
differently to the F4 - 4 x 32K, 1 x 128K with the rest 256K, so the
internal storage is 96K.

Added more pind definitions for STM32F7DISC board.  Made USART1 be the
default HWUART repl.  The STLINK usb connector also looks like a USB
serial port which is attached to USART1 on the STM32F7DISC.
2015-08-03 00:39:27 +01:00
Damien George
751485fe6b stmhal: Add support for USART1 and conditional pins in make-pins.py.
Thanks to Dave Hylands for the patch.
2015-08-03 00:23:47 +01:00
Damien George
c0e39864c6 stmhal: Fix make-pins.py to allow Port K.
Thanks to Dave Hylands for the patch.
2015-08-03 00:18:40 +01:00
Dave Hylands
92d4b51ad5 stmhal: Add STM32F7DISC and associated changes. 2015-07-30 00:38:32 +01:00
blmorris
2af846e711 stmhal/boards/stm32fxx_prefix.c: Fix alt function number calculation
This prevented pin_find_af* functions from being able to find some
of the alternate functions in the pin struct
2015-07-20 16:19:12 +01:00
Damien George
a39df51d8a stmhal: Update Makefile and board configs to compile with relocated hal. 2015-07-20 12:30:18 +01:00
Dave Hylands
11115e4d23 stmhal: Add I2S support to make-pins.py 2015-07-07 10:15:37 +01:00
Dave Hylands
3ac2d06bd1 stmhal: Add support for UART5
I tested this on my CERB40 board and it seems to be working fine.
2015-06-01 00:14:46 +01:00
Damien George
70446f46c2 stmhal: Allow to name SPI busses, and give them names for pyboard. 2015-05-27 17:21:42 +01:00
Damien George
0e6f5e08e1 stmhal: Allow to name I2C busses, and give them names for pyboard. 2015-05-27 17:16:26 +01:00
Damien George
1775b65e07 stmhal: Remove PYBVxx defines and use config vars for UART/CAN names.
Now all stmhal-based boards can name their peripherals (if they want) to
any string.
2015-05-27 16:51:04 +01:00
Eero af Heurlin
2378be4e93 stmhal: Allow to configure UART pins completely via mpconfigboard.h. 2015-05-03 13:48:26 +01:00
Damien George
404b68da88 stmhal: Provide ADC capabilities for F401 and F411 MCUs.
Simply needed to define which pins have which ADC channel on them.
2015-04-18 22:39:06 +01:00
Damien George
b42a5050fb stmhal: Add support for STM32F411 MCU. 2015-04-18 22:15:59 +01:00
Damien George
90e6d0c2ac stmhal: Add support for Espruino Pico board.
To build:

make BOARD=ESPRUINO_PICO

To deploy: short the BOOT0/BTN contact on the back of the board (eg by
drawing over it with a graphite pencil), then hold down BTN while
inserting the board into the USB port.  The board should then enter DFU
mode, and the firmware can be downloaded using:

make BOARD=ESPRUINO_PICO deploy
2015-04-18 21:40:59 +01:00
Damien George
e4b4e5aa31 stmhal: Add stm32f401.ld for linking F401 targets. 2015-04-18 21:40:59 +01:00
Damien George
0435e76250 stmhal: Make ld and af files configurable within Makefile.
Each board now needs an mpconfigboard.mk file which defines AF_FILE and
LD_FILE.

Also moved stm32f405.ld to boards/ directory to keep things organised.
2015-04-18 21:40:59 +01:00
Damien George
03ec6e4d01 stmhal: Add stm32f401_af.csv, for AF definitions of F401 MCUs. 2015-04-18 21:40:59 +01:00
Damien George
9253e7bdf7 stmhal: Rename stm32f4xx_af.csv to stm32f405_af.csv.
Since this file is only valid for F405 MCUs, not generic F4xx.
2015-04-18 21:40:59 +01:00
Damien George
d15fe5a6b3 stmhal: Make I2C busses and their pins configurable in mpconfigboard.h. 2015-04-18 21:40:59 +01:00
Damien George
50ea86fe8b stmhal: For pins, define macros mapping board names to cpu names. 2015-04-18 21:40:58 +01:00
Damien George
2e5704d101 stmhal: Make a HW config option for LED4 being controlled by PWM. 2015-04-18 21:40:58 +01:00
Damien George
8bdbc20e74 stmhal: Make HSE PLL parameters configurable per board. 2015-04-18 21:40:58 +01:00