1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

271 Commits

Author SHA1 Message Date
Gilles DOFFE
8279e54272 cpu/stm32: add clock configuration for stm32mp1
Configure stm32mp1 Cortex-M4 MCU core clock according to board
configuration.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
d78e13e906 cpu/stm32: add stm32mp1 support to clk_conf
clk_conf is a useful tool to produce clock headers for new boards.
But it only supports STM32Fx families.
This commits add the definition of a new family: STM32MP1.
Only the STM32MP157 is supported for now.

First build clk_conf:
$ make -C cpu/stm32/dist/clk_conf/

Clock header can be generated with the following command once clk_conf is
built:
$ cpu/stm32/dist/clk_conf/clk_conf stm32mp157 208000000 24000000 1
This command line will produce a core clock of 208MHz with a 24MHz HSE
oscillator and will use LSE clock which corresponds to the STM32MP157C-DK2
board configuration.
The command will output the header to copy paste into the periph_conf.h of
the board:

/**
 * @name    Clock settings
 *
 * @note    This is auto-generated from
 *          `cpu/stm32/dist/clk_conf/clk_conf.c`
 * @{
 */
/* give the target core clock (HCLK) frequency [in Hz],
 * maximum: 209MHz */
#define CLOCK_CORECLOCK     (208000000U)
/* 0: no external high speed crystal available
 * else: actual crystal frequency [in Hz] */
#define CLOCK_HSE           (24000000U)
/* 0: no external low speed crystal available,
 * 1: external crystal available (always 32.768kHz) */
#define CLOCK_LSE           (1U)
/* peripheral clock setup */
#define CLOCK_MCU_DIV       RCC_MCUDIVR_MCUDIV_1     /* max 209MHz */
#define CLOCK_MCU           (CLOCK_CORECLOCK / 1)
#define CLOCK_APB1_DIV      RCC_APB1DIVR_APB1DIV_2     /* max 104MHz */
#define CLOCK_APB1          (CLOCK_CORECLOCK / 2)
#define CLOCK_APB2_DIV      RCC_APB2DIVR_APB2DIV_2     /* max 104MHz */
#define CLOCK_APB2          (CLOCK_CORECLOCK / 2)
#define CLOCK_APB3_DIV      RCC_APB3DIVR_APB3DIV_2     /* max 104MHz */
#define CLOCK_APB3          (CLOCK_CORECLOCK / 2)

/* Main PLL factors */
#define CLOCK_PLL_M          (2)
#define CLOCK_PLL_N          (52)
#define CLOCK_PLL_P          (3)
#define CLOCK_PLL_Q          (13)
/** @} */

This result has been verified with STM32CubeMX, the official ST tool.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
5e30e60fec cpu/stm32: avoid configuring stm32mp1 APB1 clock
APB1 bus clock is always enabled is not manageable by RCC register.
So avoid enabling it.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
7a2550da9b cpu/stm32: add stm32mp1 peripheral busses
Add stm32mp1 peripheral busses AHB1, AHB2, AHB3 and AHB4 with
enable/disable functions.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
67f37950a0 cpu/stm32: default i2c configuration
* Setup i2c speed to I2C_SPEED_LOW by default
* enable i2c_write_regs() function.
* i2c frequency needs to be specified into board periph_conf.h

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
f39aa979af cpu/stm32: setup CLOCK_LSI for stm32mp1
Set stm32mp1 family LSI clock frequency to 32KHz as specified in datasheet.
STM32MP157C example:
https://www.st.com/resource/en/datasheet/stm32mp157c.pdf

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
ba5f8e1cda cpu/stm32: consider starting white spaces in gen_vectors.py
In some CMSIS headers, "typedef enum" could be preceded by white
spaces. Thus consider them when parsing the line.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
1c063a74ea
stm32: Adapt to flashpage/flashpage_pagewise API 2020-11-11 23:16:42 +01:00
2f2622c76f
cpu/stm32: move stm32l5 default PLL N to cpu 2020-11-10 09:34:07 +01:00
36d33d38f7
cpu/stm32: move stm32l4+ default PLL N to cpu 2020-11-10 09:34:07 +01:00
ef5897775d
cpu/stm32l4wb: add missing define for PLL HSI source 2020-11-10 09:34:07 +01:00
934028c114
cpu/stm32: fix l4l5wb clock configuration
Default values were wrong for WB when using HSE 32MHz as PLL input source
Default PLL input source was wrong when not using HSE and the board
provides an HSE
2020-11-10 09:34:07 +01:00
f111fd8447
cpu/stm32/kconfig.clk: adapt for l4/l5/wb 2020-11-10 09:34:06 +01:00
d2a46f58c2
stm32/flashpage: use void pointer for flash address 2020-11-09 14:28:42 +01:00
Francisco
aa79f4da17
Merge pull request #15078 from aabadie/pr/cpu/stm32f0f1f3_mco
cpu/stm32f0f1f3: add MCO configuration and initialization
2020-11-06 08:56:43 +01:00
afba298bc1
cpu/stm32f0f1f3: configure and initialize MCO 2020-11-05 21:59:00 +01:00
565242f67e
Merge pull request #15073 from aabadie/pr/cpu/stm32l0l1_mco
cpu/stm32l0l1: add MCO configuration and initialization
2020-11-05 17:03:32 +01:00
f98f5f5b49
Merge pull request #15084 from aabadie/pr/cpu/stm32gx_mco
cpu/stm32gx: add MCO configuration and initialization
2020-11-05 16:46:04 +01:00
5a2409557f
cpu/stm32gx: configure and initialize MCO 2020-11-05 13:39:19 +01:00
4b316c593a
cpu/stm32l0l1: configure MCO 2020-11-05 13:37:34 +01:00
18b5f417d1
cpu/stm32l4: implement MCO configuration 2020-11-05 13:34:45 +01:00
daa7ed54cd
Merge pull request #15000 from aabadie/pr/boards/stm32l0l1_clock_kconfig_only
boards/stm32l0l1: model clock configuration in kconfig
2020-11-03 17:20:00 +01:00
fb35edd22d
cpu/stm32: adapt clock configuration for l0/l1 2020-11-03 14:23:46 +01:00
Leandro Lanzieri
500cf238b8
cpu/stm32/vendor: use submake to fetch CMSIS headers 2020-11-03 13:33:16 +01:00
Marian Buschsieweke
125c892c03
drivers/periph/timer: Use uint32_t for frequency
For all currently supported platforms `unsigned long` is 32 bit in width. But
better use `uint32_t` to be safe.
2020-10-30 22:02:12 +01:00
7fbfb92f03
boards/stm32gx: move Kconfig clock config to cpu 2020-10-29 23:00:44 +01:00
Marian Buschsieweke
45dc86acce
cpu/stm32: Fix reception bug in periph_eth
The reception code hands RX DMA descriptors back to the DMA right after its
contents were copied into the network stack internal buffer. This increases
the odds that the DMA never runs out of DMA descriptors to fill, even under
high load. However, the loop fetching the Ethernet frame stops to iterate at the
end of the frame. If the DMA used one more descriptor to store the FCS, this
was not returned back to the DMA. This commit fixes it.
2020-10-28 14:23:25 +01:00
Marian Buschsieweke
7ced6a8ac8
cpu/stm32: Improve debug output for periph_eth 2020-10-28 14:22:54 +01:00
benpicco
2050193030
Merge pull request #15273 from aabadie/pr/cpu/stm32_clk_cfg_in_cpu
boards/stm32: cpu/stm32: move clock configuration from boards to cpu
2020-10-27 10:04:01 +01:00
0bd70a46bc
cpu/stm32: rework clock configuration documentation 2020-10-27 08:54:09 +01:00
ec5b47fc61
cpu/stm32l4+/wb: centralize max core clock define, adapt related boards 2020-10-27 08:44:55 +01:00
05f67a0a00
cpu/stm32: remove useless include in clock configuration 2020-10-26 11:21:07 +01:00
d6d85a3370
cpu/stm32: add common clock configuration header 2020-10-26 11:21:07 +01:00
f2e2c89424
cpu/stm32: move clock configuration headers to cpu 2020-10-26 11:16:23 +01:00
4e50feb4a8
cpu/stm32: adapt Kconfig for stm32l5 2020-10-23 18:28:27 +02:00
bd24a71fe0
cpu/stm32/kconfig: create family directory if not exist 2020-10-23 18:21:51 +02:00
7f26d5c389
cpu/stm32l5: adapt flashpage periph 2020-10-23 18:21:50 +02:00
a416b2793f
cpu/stm32: add basic support for stm32l5 2020-10-23 18:21:50 +02:00
b1b6c33104
cpu/stm32/dist/irqs: adapt for stm32l5 2020-10-23 18:13:07 +02:00
02c4b05a5a
cpu/stm32: configure stm32l5 cmsis repository version 2020-10-23 18:13:07 +02:00
benpicco
ad294aa340
Merge pull request #15203 from maribu/stm32-eth-negotiate
cpu/stm32: periph_eth: Use auto-negotation
2020-10-23 14:22:56 +02:00
Bas Stottelaar
7eb3414cff cpu/*: remove unneeded ENABLE_DEBUG 2020-10-23 11:29:57 +02:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Bas Stottelaar
bd34cf8fc0 cpu/*: reorder ENABLE_DEBUG after last include 2020-10-23 00:45:55 +02:00
Marian Buschsieweke
5f9b55a182
cpu/stm32: Add stm32_eth_auto for auto-negotiation
Expose the auto-negotiation feature of the Ethernet device via the
pseudo-module stm32_eth_auto. With this enabled, the static speed configuration
set in the boards periph_conf.h will only be used if the PHY lacks
auto-negotiation capabilities - which is unlikely to ever happen.
2020-10-22 12:37:23 +02:00
Bas Stottelaar
ab6188cea3 cpu/*: add missing include of assert.h 2020-10-22 11:13:08 +02:00
72c17588b9
boards/stm32: remove unused CLOCK_LSE define 2020-10-21 12:11:17 +02:00
9f985e8e56
cpu/stm32: use CONFIG_BOARD_HAS_LSE instead of CLOCK_LSE 2020-10-21 12:10:53 +02:00
fed1c4dbbe
Merge pull request #15259 from aabadie/pr/cpu/stm32_cleanup_disable_hsi
cpu/stm32: simplify stmclk_disable_hsi function
2020-10-21 11:19:30 +02:00
84306f1122
cpu/stm32: remove unused CLOCK_HSE define 2020-10-21 10:11:46 +02:00