SysConfig generates code for DMA transfers from ADC12 using function
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
SysConfig generates code for DMA transfers from ADC12 using function
Hi Mykhaylo,
Can you share with me your sysconfig file, or let me know how are you configuring your ADC (as well as the device you are using)? Finally, can you let me know the version of CCS, SYSCONFIG, and the SDK you are using?
Best Regards,
Diego Abad
/**
* Import the modules used in this configuration.
*/
const ADC12 = scripting.addModule("/ti/driverlib/ADC12", {}, false);
const ADC121 = ADC12.addInstance();
const ADC122 = ADC12.addInstance();
const DMA = scripting.addModule("/ti/driverlib/DMA");
const GPIO = scripting.addModule("/ti/driverlib/GPIO", {}, false);
const GPIO1 = GPIO.addInstance();
const GPIO2 = GPIO.addInstance();
const MCAN = scripting.addModule("/ti/driverlib/MCAN", {}, false);
const MCAN1 = MCAN.addInstance();
const PWM = scripting.addModule("/ti/driverlib/PWM", {}, false);
const PWM1 = PWM.addInstance();
const SYSCTL = scripting.addModule("/ti/driverlib/SYSCTL");
const TIMER = scripting.addModule("/ti/driverlib/TIMER", {}, false);
const TIMER1 = TIMER.addInstance();
const TIMER2 = TIMER.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
const gate7 = system.clockTree["MFCLKGATE"];
gate7.enable = true;
const gate8 = system.clockTree["MFPCLKGATE"];
gate8.enable = true;
const mux4 = system.clockTree["EXHFMUX"];
mux4.inputSelect = "EXHFMUX_XTAL";
const mux8 = system.clockTree["HSCLKMUX"];
mux8.inputSelect = "HSCLKMUX_HFCLK";
const mux12 = system.clockTree["SYSPLLMUX"];
mux12.inputSelect = "zSYSPLLMUX_HFCLK";
const pinFunction4 = system.clockTree["HFXT"];
pinFunction4.inputFreq = 40;
pinFunction4.enable = true;
pinFunction4.HFCLKMonitor = true;
pinFunction4.HFXTStartup = 30;
ADC121.$name = "ADC0";
ADC121.endAdd = 11;
ADC121.trigSrc = "DL_ADC12_TRIG_SRC_EVENT";
ADC121.adcMem10chansel = "DL_ADC12_INPUT_CHAN_11";
ADC121.pubChanID = 14;
ADC121.disChan11 = true;
ADC121.enabledEvents = ["DL_ADC12_EVENT_MEM0_RESULT_LOADED"];
ADC121.subChanID = 12;
ADC121.adcMem11chansel = "DL_ADC12_INPUT_CHAN_11";
ADC121.adcMem11trig = "DL_ADC12_TRIGGER_MODE_TRIGGER_NEXT";
ADC121.adcMem0chansel = "DL_ADC12_INPUT_CHAN_11";
ADC121.repeatMode = true;
ADC121.sampleTime0 = "0";
ADC121.sampleTime1 = "0";
ADC121.sampClkSrc = "DL_ADC12_CLOCK_ULPCLK";
ADC121.enabledInterrupts = ["DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED"];
ADC121.configureDMA = true;
ADC121.enabledDMATriggers = ["DL_ADC12_DMA_MEM0_RESULT_LOADED"];
ADC121.adcMem0trig = "DL_ADC12_TRIGGER_MODE_TRIGGER_NEXT";
ADC121.peripheral.$assign = "ADC0";
ADC121.DMA_CHANNEL.$name = "DMA_CH0";
ADC121.DMA_CHANNEL.enabledEvents = ["EVENT_CHANNEL"];
ADC121.DMA_CHANNEL.peripheral.$assign = "DMA_CH0";
ADC122.$name = "ADC1";
ADC122.endAdd = 3;
ADC122.repeatMode = true;
ADC122.trigSrc = "DL_ADC12_TRIG_SRC_EVENT";
ADC122.pubChanID = 15;
ADC122.adcMem1chansel = "DL_ADC12_INPUT_CHAN_1";
ADC122.adcMem2chansel = "DL_ADC12_INPUT_CHAN_2";
ADC122.adcMem3chansel = "DL_ADC12_INPUT_CHAN_15";
ADC122.enabledEvents = ["DL_ADC12_EVENT_MEM0_RESULT_LOADED"];
ADC122.sampClkSrc = "DL_ADC12_CLOCK_ULPCLK";
ADC122.enabledInterrupts = ["DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED"];
ADC122.configureDMA = true;
ADC122.subChanID = 14;
ADC122.adcMem0trig = "DL_ADC12_TRIGGER_MODE_TRIGGER_NEXT";
ADC122.enabledDMATriggers = ["DL_ADC12_DMA_MEM0_RESULT_LOADED"];
ADC122.peripheral.$assign = "ADC1";
ADC122.adcPin0Config.hideOutputInversion = scripting.forceWrite(false);
ADC122.adcPin0Config.$name = "ti_driverlib_gpio_GPIOPinGeneric0";
ADC122.DMA_CHANNEL.enabledEvents = ["EVENT_CHANNEL"];
ADC122.DMA_CHANNEL.$name = "DMA_CH1";
ADC122.DMA_CHANNEL.peripheral.$assign = "DMA_CH1";
const Board = scripting.addModule("/ti/driverlib/Board", {}, false);
DMA.sub1ChanID = 12;
DMA.pubChanID = 2;
DMA.sub0ChanID = 3;
GPIO1.$name = "GPIO_TST_0";
GPIO1.port = "PORTB";
GPIO1.portSegment = "Upper";
GPIO1.associatedPins.create(3);
GPIO1.associatedPins[0].$name = "PIN_0";
GPIO1.associatedPins[0].pin.$assign = "PB22";
GPIO1.associatedPins[1].$name = "PIN_RED";
GPIO1.associatedPins[1].subOutputPolicy = "TOGGLE";
GPIO1.associatedPins[1].pin.$assign = "PB26";
GPIO1.associatedPins[2].$name = "PIN_GREEN";
GPIO1.associatedPins[2].subOutputPolicy = "TOGGLE";
GPIO1.associatedPins[2].subChanID = 10;
GPIO1.associatedPins[2].pin.$assign = "PB27";
GPIO2.$name = "GPIO_GRP_A";
GPIO2.port = "PORTA";
GPIO2.portSegment = "Lower";
GPIO2.associatedPins.create(2);
GPIO2.associatedPins[0].$name = "PIN_STB";
GPIO2.associatedPins[0].pin.$assign = "PA14";
GPIO2.associatedPins[1].$name = "PIN_DBG1";
GPIO2.associatedPins[1].subOutputPolicy = "TOGGLE";
GPIO2.associatedPins[1].subChanID = 15;
GPIO2.associatedPins[1].pin.$assign = "PA0";
MCAN1.$name = "MCAN0";
MCAN1.peripheral.$assign = "CANFD0";
MCAN1.peripheral.rxPin.$assign = "PA13";
MCAN1.peripheral.txPin.$assign = "PA12";
MCAN1.txPinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric6";
MCAN1.rxPinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric7";
PWM1.$name = "PWM_0";
PWM1.subscriberPort = "FSUB0";
PWM1.event1PublisherChannel = 1;
PWM1.event1ControllerInterruptEn = ["ZERO_EVENT"];
PWM1.clockDivider = 8;
PWM1.timerCount = 50000;
PWM1.timerStartTimer = true;
PWM1.peripheral.$assign = "TIMA0";
PWM1.PWM_CHANNEL_0.$name = "ti_driverlib_pwm_PWMTimerCC0";
PWM1.PWM_CHANNEL_0.dutyCycle = 50;
PWM1.PWM_CHANNEL_1.$name = "ti_driverlib_pwm_PWMTimerCC1";
PWM1.ccp0PinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric5";
PWM1.ccp1PinConfig.$name = "ti_driverlib_gpio_GPIOPinGeneric8";
SYSCTL.clockTreeEn = true;
TIMER1.$name = "TIMER_0";
TIMER1.timerStartTimer = true;
TIMER1.enableShadowLoad = true;
TIMER1.timerClkDiv = 2;
TIMER1.timerPeriod = "1 ms";
TIMER1.event1ControllerInterruptEn = ["LOAD_EVENT"];
TIMER1.event2PublisherChannel = 13;
TIMER1.timerMode = "PERIODIC_UP";
TIMER1.event2ControllerInterruptEn = ["ZERO_EVENT"];
TIMER1.peripheral.$assign = "TIMG6";
TIMER2.$name = "TIMER_1";
TIMER2.timerMode = "PERIODIC_UP";
TIMER2.timerClkDiv = 8;
TIMER2.event1PublisherChannel = 12;
TIMER2.timerStartTimer = true;
TIMER2.enableShadowLoad = true;
TIMER2.event1ControllerInterruptEn = ["ZERO_EVENT"];
TIMER2.timerPeriod = "1ms";
TIMER2.peripheral.$assign = "TIMG7";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
* re-solve from scratch.
*/
pinFunction4.peripheral.$suggestSolution = "SYSCTL";
pinFunction4.peripheral.hfxInPin.$suggestSolution = "PA5";
pinFunction4.peripheral.hfxOutPin.$suggestSolution = "PA6";
ADC122.peripheral.adcPin0.$suggestSolution = "PA15";
Board.peripheral.$suggestSolution = "DEBUGSS";
Board.peripheral.swclkPin.$suggestSolution = "PA20";
Board.peripheral.swdioPin.$suggestSolution = "PA19";
PWM1.peripheral.ccp0Pin.$suggestSolution = "PA2";
PWM1.peripheral.ccp1Pin.$suggestSolution = "PA1";
Hello Diego, this is the sysconfig - was unable to add it as a file.
CCS is Version: 20.2.0.12__1.8.0
sysconfig 1.25.0
SDK 2.7.0.05
turns out SysConfig allow to supply field "DMA Samples Count" with 0 value. which i think should be fixed.