F446 96boards definition problems.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
olpol
Posts: 4
Joined: Mon Oct 19, 2020 10:41 am

F446 96boards definition problems.

Post by olpol »

HI all,

I am trying to use chibios with the STM32 96Boards Sensor board in standalone mode ( not currently supported )
The board runs an stm32f446, and has arduino pin header.

and the first project is a pwm driver for ws2812 driver from joewa's ws2812 github repository.
I am using a config derived from a nucleo f446, but with a 16mhz external oscillator.
PWM output is to the arduino connector D13, which maps to gpio E2,

My pal line mappings are incomplete, but I have remove the nucleo specific entries.
updateing the board.chcfg


in the code I have
palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(WS2812_AF));


If I set HSI and HSE BYPass to true it hangs on

while ((RCC->CR & RCC_CR_HSERDY) == 0)
; /* Waits until HSE is stable.


If HSI and HSE BYPass set to false it runs( as i think it should be), DMA triggers callbacks, and thread run as expected.



Is my approach and setup correct with the following driver setup


#define PORT_WS2812 GPIOE
#define PIN_WS2812 2 // arduino connector pin D13
#define WS2812_TIM_N 4 // timer, 1-11
#define WS2812_TIM_CH 3 // timer channel, 0-3
#define WS2812_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) // DMA stream for TIM4_UP
#define WS2812_DMA_CHANNEL 2



and mcuconf.h


#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED TRUE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 16
#define STM32_PLLN_VALUE 336
#define STM32_PLLP_VALUE 2
#define STM32_PLLQ_VALUE 2
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SM_VALUE 16
#define STM32_PLLI2SR_VALUE 2
#define STM32_PLLI2SP_VALUE 2
#define STM32_PLLI2SQ_VALUE 12
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2




#define WS2812_AF 2 // af2 for pwm on timer 4 as per manual




Many thanks for any input/direction.


Oli
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: F446 96boards definition problems.

Post by Giovanni »

Hi,

Not sure, exactly what is your question?

The general approach looks right.

Giovanni
olpol
Posts: 4
Joined: Mon Oct 19, 2020 10:41 am

Re: F446 96boards definition problems.

Post by olpol »

Many thanks for looking.

Is it correct to set HSE BYPASS and HSI BYPASS to false then ( for external crystal)?

Oli
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: F446 96boards definition problems.

Post by Giovanni »

It needs to be TRUE for external oscillators or external clock sources, FALSE for regular crystals. See the RCC section in the STM32 RM.

Giovanni
olpol
Posts: 4
Joined: Mon Oct 19, 2020 10:41 am

Re: F446 96boards definition problems.

Post by olpol »

Thought so, so I guess the key issue is that HSE is never stable and hangs in hal_lld.c.

((RCC->CR & RCC_CR_HSERDY) == 0)

Any clues what might cause this?

Oli
olpol
Posts: 4
Joined: Mon Oct 19, 2020 10:41 am

Re: F446 96boards definition problems.

Post by olpol »

Sorry. My bad. Get it now,

Thanks for your help.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: F446 96boards definition problems.

Post by Giovanni »

My fault about STM32_HSE_BYPASS, it should be defined/undefined rather than TRUE/FALSE.

Giovanni
Post Reply