2023-03-15 08:46 AM
We tried the simplest and the most basic LL driver based App, LED blinking, on Nucleo boards:
int main(void)
{
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
SystemClock_Config();
MX_GPIO_Init();
MX_USART2_UART_Init();
while (1)
{
LL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);
LL_mDelay(1000);
}
}
Comments and empty lines are removed. We just added two lines of code in the while loop. Everything else is from MX. (LED pin changes with different Nucleo boards).
Well, it doesn't work. It failed on Nucleo-L432KC and Nucleo-L452RE. Both are L4 MCU so they use the same FW and library. It can't pass through the system clock configuration. The MCO output of the internal PLL has no life at all.
However, it works on Nucleo-WB55RG. The LED is blinking!
Is there anything I missed in LL based programming? or is there anything to fix for L4 firmware and library?
Thanks. -wq
Solved! Go to Solution.
2023-03-22 11:39 PM
HSE can also be used with it. You just have to switch the HSE oscillator to bypass so that it can use the externally supplied 8 MHz.
2023-03-23 09:46 AM
Thanks Peter! it is good to know that external clock can be used to OSC_IN. The datasheet and RM didn't mention it. I was wondering for a while. Even I wanted to try STLINK's MCO clock, I had to solder a few SBs. So, I was lazy and moved to HSI. It worked but UART (STLINK's VCP) was scrambled. Then I switched to MSI (with LSE turned on according to the documents). UART worked. I would then be able to test DAC and ADC that didn't work well on NUCLEO-L432KC.
Long story short, DAC started to work when I switched to HAL (others are still LL). I still don't understand it. DAC is a simple peripheral and the LL driver was copied (referenced) from Example(s). I will look at it further. The ADC still didn't work well, the internal VREFINT/TS/VBAT channels are still interfered by analog channels when they are in multiple channels for continuous/scanning sampling.
It is same to L432KC, DAC started to work with HAL driver and ADC's internals are interfered by analog pin signal.
-wq