AUTOSAR Experiment 5 DMA + hardware triggering ADC conversions

First, the purpose of the experiment 

(1) be familiar adc and DMA

Second, the experimental environment

Window10

Server: windows

And server interaction software winscp putty

AUTOSAR Version: 4.2.2

Tresos studio 23.0

MCAL Version: S32K14X_MCAL4_2_RTM_HF8_1_0_1

Compiling environment:greenhill 201714

Debugging environment: ic5000

 

Third, the experimental procedures

1. Complete the hardware trigger adc adc

2. DMA channel configuration interrupt parameters

3. Project DMA interrupt register

4. mcl related to the module, adc module, mcu module, gpt modules, port module

5. related to the interrupt ADC interrupt or DMA interrupt, the interrupt is useless to GPT

Four, DMA parameters

1. Configure DMA interrupt, the interrupt enable setting

Configuring DMA instance (optionally provided, the specific role is unknown )

3.配置DMA Logical Channels

highest numbered master having the highest priority

4. Configuration adc

Fourth, the project DMA interrupt register

How come parameters, referring to the second experiment, do not forget to declare extern interrupt handler.

 

Fifth, the implementation code

Initialization part

    /* init Port */

    Port_Init(&PortConfigSet);

    /*init Mcl*/

    Mcl_Init(&MclConfigSet_0);

    IoHwAB_Init_Intterupt();

    /* init Gpt */

    Gpt_Init(&GptChannelConfigSet);

    Gpt_EnableNotification(GptConf_GptChannelConfiguration_GptChannelConfiguration_0);

Adc_Init(&AdcConfigSet);

Adc_SetupResultBuffer(AdcGroup_0, AdcGroup_0_Res);

Adc_EnableGroupNotification(AdcGroup_0);

Adc_EnableHardwareTrigger(AdcGroup_0);

/ * Start timer * /

Gpt_StartTimer(GptConf_GptChannelConfiguration_GptChannelConfiguration_0, 40000);

 

Interrupt notification function

FUNC(void, ADC_CODE) Adc_Adc12bsarv2_DmaTransferComplete0()

{

    Adc_Adc12bsarv2_DmaEndGroupConversion((Adc_HwUnitType)ADC_UNIT_0);

}

 

Sixth, verification

Data, the value read by the changes observed watch.

Published 39 original articles · won praise 29 · views 30000 +

Guess you like

Origin blog.csdn.net/wx601056818/article/details/104803333