Bringing up a new board with STM32L443 hangs in the HAL initialization routines.
It was hanging in many of the initiaization routines. There was a problem with the clock. I had an external 16 MHz crystal So I switched back to the internal and it got past that one for now.
It got through MX_GPIO_Init();
MX_DMA_Init();
MX_ADC1_Init();
It had a problem with TIM2 where it setup the GPIO for PWM. So I commented out the initialization for now.
I find it is easier to debug if I can write out to the UART, then I have a written and saved states of variables, and it helps find problems quicker.
Now I am on MX_USART1_UART_Init();
It appears to be failing on this one as soon as I single step out of the NVIC_EncodePriority inline function.
/**
\brief Encode Priority
\details Encodes the priority for an interrupt with the given priority group,
preemptive priority value, and subpriority value.
In case of a conflict between priority grouping and available
priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
\param [in] PriorityGroup Used priority group.
\param [in] PreemptPriority Preemptive priority value (starting from 0).
\param [in] SubPriority Subpriority value (starting from 0).
\return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
*/
__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
{
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
uint32_t PreemptPriorityBits;
uint32_t SubPriorityBits;
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
return (
((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
);
}It comes in with PriorityGroup = 3
PreemptPriority = 0
SubPriority = 0
It creates:
PriorityGroupTmp = 3
PreemptPriorityBits = 4
SubPriorityBits = 0
When I exit this routine with a single step, the debugger stops working. The only thing I can do is Terminate.
If I suspend it says 0x1fff2ea4 but I do not know how to interpret that,
Are there any ideas where I should look to get this working?
Kip
