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.
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.
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.
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.
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.
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.
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.
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.
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.
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.