2018-02-07 06:56 AM
Hi Everyone,
I am brand new to the community and so far I'm pretty impressed!
I am relatively inexperienced and I'm just getting up to speed migrating from the underwhelming TI microcontroller platform so my questions may be a bit rudimentary. I've found the example code for the L4 HAL quite useful and I'm already making some progress. In the example code I notice:
1. Often there are lines reading PPPhandle.instance = PPPx (for example AdcHandle.Instance = ADCx) and I notice that eclipse throws a warning on this. I assumed that ADCx, ADCy, TIMx, etc need to be changed to ADC1, ADC2, TIM3, etc. Is that assumption correct?
2. Likewise, I notice in the example code sConfig.Channel = ADCx_CHANNELa; and I assume that this must change to the form of ADC1_CHANNEL_0 for example. Is that assumption correct?
3. In one of the HAL examples , the goal is to set a timer trigger ADC channel. In the code there is
a) an ADC_Config function which sets AdcHandle_master.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T3_TRGO;. I assume based on this and the comment that this ADC in question is to be triggered on the T3 timer state change.
b) a TIM_Config function which declares an instance TimHandle.Instance = TIMx . I see no mention of T3 elsewhere in the function. Am I correct to assume that TIMx must be changed to TIM3 in order to configure it as the trigger for the ADC?
4) Probably most importantly...based on the example code, L4 HAL Manual, and STM32L471VGT6-LQFP-100 datasheet, it is unclear to me how to know when a peripheral is configured (say ADC1 or TIM1) how exactly that gets mapped to a specific pin on the microcontroller? Can someone explain this to me?
Once again I realize some of this may be obvious to you all but I am inexperienced and brand new to the platform. I appreciate any help you're able to give!
Thanks!
Jim
#hal_tim #stm32-l4 #hal-adc #cubemx-repository-example-projects2018-02-07 11:42 AM
Additionally, I notice that in the L4 HAL Manual, there is a section on page 103 that reads:
Optionally, in case of usage of DMA:
-Configure the DMA (DMA channel, mode normal or circular, ...) using function
HAL_DMA_Init().-Configure the NVIC for DMA using functionHAL_NVIC_EnableIRQ(DMAx_Channelx_IRQn)-Insert the ADC interruption handler function HAL_ADC_IRQHandler() into the
function of corresponding DMA interruption vectorDMAx_Channelx_IRQHandler().However I notice that in the implementation of this in example code: ADC/ADC_Sequencer/Src/main.c, they don't do this step. I believe that this is because they simply configure the ADC to be triggered by DMA then use a callback to change a flag when the circ buffer is full. Is the example code incomplete or is this step quoted above not necessary for the application in the code?
Jim
2018-02-07 03:19 PM
Did you see the Cube software ?
it is a configuration tool, it shows the pins and functions and the clocks and distribution of those clocks, and lets you configure the Uarts, ADCs, timers etc.