PSoC4 - ADC scan never finishes (or starts?) | Cypress Semiconductor
PSoC4 - ADC scan never finishes (or starts?)
First-time PSoC4 user/noob here. I've got a few of the CY8KIT-049-42xx kits (specced by customer - chip is CY8C4245AXI-483) and am trying to work from the CE95272 (Diff. PreAmplifier) application note to put together a simple multichannel ADC-sampling-to-UART-port proof of concept. However, after starting the ADC, the example hangs waiting for the ADC to be 'done' (dataReady asserted) - the interrupt never fires. When I replace this with a polling loop to report the value of ADC_IsEndConversion(ADC_RETURN_STATUS), it just reports 0 (not finished) always.
Tried so far:
- Ensured correct chip ise selected (Project -> Device Selector)
- Update all TopDesign.cysch components (Project -> Update Components - most were version 1.x; ADC now at version 2.30)
- Remove the flag-check from the ISR so that any hit to ADC_ISR_Handler will assert dataReady (for testing) - nothing
- Confirm configuration of SAR ADC: all defaults from the example except for sample rate
- Sample rate 150Hz, within range specified to the right of it, which I assume refers to the legal range according to the current clock configuration?
- Clock source Internal
- Sample mode Free running
- Vref: Internal 1.024V, single-ended neg. input Vss
- Result format signed, right-justified, 128 averages, alt. resolution 8 bits, averaging mode 'Fixed resolution'
- A/B/C/D clocks: 4
- Sequenced channels: 4 (0, 1, 2, 3 - 2 diff, 2 SE)
- Confirm ADC pin assignments in *.cydwr look OK and are valid for the kit
Note, the "ADC_IRQ_StartEx(ADC_ISR_Handler)" call in the example to register the interrupt handler isn't in the ADC documentation, but "ADC_IRQ_Enable()" (not used in the example) is. Adding this seems to have no effect.
For testing, my 'main loop' now consists of:
while(dataReady == 0u) // <-- hung here
//; /* Wait for ADC conversion */
UART_UartPutString("\r\nADC Status: ");
UART_UartPutChar( (uint8_t)ADC_IsEndConversion(ADC_RETURN_STATUS) + CONVERT_TO_ASCII);
// ...unreached code here...
The output is a neverending stream of "ADC Status: 0" messages.
Is there any special (chip-specific?) trick I'm missing to getting the ADC to start/finish conversion, or any advice on how to debug this further?