Hello,
I`m using TMS320F2809 with 100MHz clock.
1. I would like to get some info about init of adc and then using it. There is a need to use two adc inputs but used independently, if i want to sample channel 0 should i do sth like?:
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;
AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1;
while(AdcRegs.ADCST.bit.SEQ1_BSY) {};
return AdcRegs.ADCRESULT0 >> 4;
and if i want to sample channel 1 do i need to change 0x0 to 0x1 only and the rest stays as it is?
and the initialisation of adc is here:
#define ADC_MODCLK 0x4
#define ADC_CKPS 0x1
#define ADC_SHCLK 0xf
AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK; // s/h width in adc module periods
AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS; // adc module clock = HSPCLK/2*ADC_CKPS
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 - Cascaded mode
AdcRegs.ADCTRL1.bit.CONT_RUN = 0; // Setup start/stop run (0)
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // adc0 channel
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/ref cirq
DELAY_US(8000L); // Minimum 7ms before powering up rest of ADC
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
DELAY_US(100L); // Delay before converting ADC channels (min 20us)
2. Do all ISR`s should be mapped to SARAM if i do boot to flash?
now i have:
#pragma CODE_SECTION(cpu_timer0_isr, "ramfuncs");
#pragma CODE_SECTION(scia_rx_isr, "ramfuncs");
#pragma CODE_SECTION(scib_rx_isr, "ramfuncs");
because for know i use three isrs. For now i`m writting the software without the board so i cant test my ideas.
Thanks for any help.