STM32F405RG clock and CAN configuration
Posted: Wed Aug 31, 2016 2:10 pm
Hello All
I have STM32F405RG board with 8MHz xtal, I have problems with configure clock and CAN settings, I got errors:
I have checked with STM32CubeMX: here and clock looks correctly.
Second problem is CAN, Ihave defined CAN but "not present in the selected device"
My configuration:
board.h
mcuconf.h
I have STM32F405RG board with 8MHz xtal, I have problems with configure clock and CAN settings, I got errors:
Code: Select all
In file included from ../chibios/os/hal/include/hal.h:32:0,
from ../chibios/os/hal/src/hal.c:25:
../chibios/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1140:2: error: #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
#error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1160:2: error: #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
#error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1239:2: error: #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
#error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1457:2: error: #error "invalid STM32_RTCPRE value specified"
#error "invalid STM32_RTCPRE value specified"
^
../chibios/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1467:2: error: #error "invalid STM32_RTCPRE value specified"
#error "invalid STM32_RTCPRE value specified"
^
In file included from ../chibios/os/hal/include/can.h:103:0,
from ../chibios/os/hal/include/hal.h:48,
from ../chibios/os/hal/src/hal.c:25:
../chibios/os/hal/ports/STM32/LLD/CANv1/can_lld.h:128:2: error: #error "CAN1 not present in the selected device"
#error "CAN1 not present in the selected device"
^
../chibios/os/hal/ports/STM32/LLD/CANv1/can_lld.h:132:2: error: #error "CAN2 not present in the selected device"
#error "CAN2 not present in the selected device"
^
../chibios/os/hal/ports/STM32/LLD/CANv1/can_lld.h:331:3: error: unknown type name 'CAN_TypeDef'
CAN_TypeDef *can;
I have checked with STM32CubeMX: here and clock looks correctly.
Second problem is CAN, Ihave defined CAN but "not present in the selected device"
My configuration:
board.h
Code: Select all
#define BOARD_STM32F405
#define BOARD_NAME "STM32F405"
/*
* Board oscillators-related settings.
* NOTE: LSE not fitted.
*/
#if !defined(STM32_LSECLK)
#define STM32_LSECLK 0U
#endif
#if !defined(STM32_HSECLK)
#define STM32_HSECLK 8000000U
#endif
#define STM32F405xx
mcuconf.h
Code: Select all
#define STM32F4xx_MCUCONF
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED FALSE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 4
#define STM32_PLLN_VALUE 144
#define STM32_PLLP_VALUE 2
#define STM32_PLLQ_VALUE 6
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCPRE_VALUE 1
#define STM32_MCO1SEL STM32_MCO1SEL_HSI
#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 2
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE
/*
* CAN driver system settings.
*/
#define STM32_CAN_USE_CAN1 TRUE
#define STM32_CAN_USE_CAN2 TRUE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
#define STM32_CAN_CAN2_IRQ_PRIORITY 11