Probably not a bug, but still a problem, and I still need help in case anyone have seen this before (looks like the dual adc has not been used much so far).
After a long testing night, I came to the conclusion that the described problem is caused by some kind of interference between the dual adc setup commands, but no final conclusion yet.
I deviced a dedicated clean program for testing, and got it to work properly.
Here it is. Can be used to test the somewhat confusing dual sequential adc sequence settings.
/*
Maple IDE DADC Sequence Test
prepared by samtal and can be used without restriction.
(No warranty wnatsoever!)
11-aug-2011
*/
void setup()
{
set_dual_mode(ADC1,DADC_MODE_6); //6=0110= Dual simult. only
//mask: 1048575 = 11111111111111111111 20 bits mask for SQR1 only, to protect the length bits.
adc_set_reg_seqlen(ADC1, 16);
adc_set_reg_seqlen(ADC2, 16);
ADC1->regs->SQR1|=493 & 1048575; //493=01111.01101=15,13
ADC1->regs->SQR2=11559; //11559=01011.01001.00111=11,9,7
ADC1->regs->SQR3=5217; //5217=00101.00011.00001=5,3,1
ADC2->regs->SQR1|= 526 & 1048575; // 526=00000.10000.01110=16,14
ADC2->regs->SQR2=12616; //12616=01100.01010.01000=12,10,8
ADC2->regs->SQR3=6210; //6210=00110.00100.00010=6,4,2
}
void loop()
{
SerialUSB.println(" SQR1 SQR2 SQR3 ");
SerialUSB.print("ADC1 ");
SerialUSB.print(ADC1->regs->SQR1,BIN);
SerialUSB.print("\t");
SerialUSB.print(ADC1->regs->SQR2,BIN);
SerialUSB.print("\t");
SerialUSB.println(ADC1->regs->SQR3,BIN);
SerialUSB.print("ADC2 ");
SerialUSB.print(ADC2->regs->SQR1,BIN);
SerialUSB.print("\t");
SerialUSB.print(ADC2->regs->SQR2,BIN);
SerialUSB.print("\t");
SerialUSB.println(ADC2->regs->SQR3,BIN);
}