Note: This is a follow up to expand on the 'related question' which discusses a problem where the ADC module stops working despite being configured in repeat-sequence-of-channels. I no longer believe that ADC42 from the device errata explains the behavior.
Behavior
While doing system testing, I discovered that I was able to reproduce the ADC freeze consistently by inducing PUCs with watchdog trips and MPU violations. Now that I was able to reproduce the problem, I used GDB to monitor the ADC12CTL0, ADC12CTL1, ADC12CTL2, and ADC12CTL3 before, during, and after a PUC reset in order to identify the issue. The only difference occurs in ADC12CTL0 with the ADC12SC bit.
ADC config & init
My ADC init process includes the following:
/* adc control register config */ ADC12CTL0 = 0; // Disable ADC, Enable config ADC12CTL0 |= ADC12SHT1_2; // 16 ADC12CLK cycles (ADC12MEM8 - ADC12MEM23) ADC12CTL0 |= ADC12SHT0_2; // 16 ADC12CLK cycles (ADC12MEM0 - ADC12MEM7, ADC12MEM24 - ADC12MEM31) ADC12CTL0 |= ADC12MSC; // Multiple sample and conversion mode ADC12CTL0 |= ADC12ON; // Turn on ADC /* ... config for other ADC12CTLs and ADC12MCTLs ... */ /* Enable ADC conversions, Start ADC conversions */ ADC12CTL0 |= ADC12ENC | ADC12SC;
The board init process passes through this init regardless of the source of the reset. This means that whether the reset was caused by a PUC or BOR, the config is the same. And indeed, in all cases the first 5 lines produce the same result. The ADC12CTL0 register is set to 0 and then configured to 0010001010010000.
Error Mechanism
The error is produced in the last line of the config when the ADC is enabled and conversions are started.
ADC12CTL0, normal operation: 0010001010010010
ADC12CTL0, error mode operation: 0010001010010011
After a variable number of PUCs (usually 1-3), the ADC12SC bit is not reset after being toggled high despite the user guide stating that ADC12SC is reset automatically:
Conclusion
The observed ADC module "freeze" has been observed on multiple MSP430FR5969s and is caused by the ADC12SC bit. The ADC12SC bit fails to reset automatically after a PUC reset. Any insight into what might cause this would be appreciated.
