![]() ![]() It also implements a full set of DSP instructions and a memory protection unit (MPU) which enhances application security. The Cortex-M4 core features a Floating point unit (FPU) single precision which supports all Arm ® single-precision data-processing instructions and data types. On most complex MCUs I've seen, the A/D converter always has some errata.The STM32L432xx devices are the ultra-low-power microcontrollers based on the high-performance Arm ® Cortex ®-M4 32-bit RISC core operating at a frequency of up to 80 MHz. Due to human mistakes, the actual chip you're using may not behave exactly as the datasheet would imply. Datasheets document the wishes of the designers in ideal circumstances. You also need to check in the datasheet whether the ADC data register allows multiple reads without starting another conversion, and make sure that you've set it for continuous conversion.Īnd most importantly: read the errata sheet for your chip. The ADC needs a clock signal, since it's a SAR, and that clock cannot be too fast or you'll be getting funky results. In many cases some initialization code, such as clock selection for the ADC, may have "interesting" side effects. ![]() It should work fine then, assuming you've made no other mistakes. Just replace it.ĭon't feed more than the ADC reference voltage, e.g. After exceeding the absolute maximum ratings, the chip may misbehave in interesting ways, and you'll never be able to fully trust it. It seems that the chip "works fine": you don't know that. The clock is configured to be the system clock at 80Mhz I suspect the problem is in my initialization code but I am already following the reference manual init sequence maybe there's some detail I am missingĪfter you've fed 5V to that ADC input pin, consider the MCU chip junk and replace it. Orr r0, #(5 << 6) r0, channel 5 adc sampling time to be 24.5 clock cyclesĮDIT1: The PA0 is connected directly to the 5v output from the 10k pot (PA0 is 5v tolerant as indicated in the datasheet)ĪGAIN it actually shows the correct value for the conversion for a sec but it changes immediately to a wrong one so I don't think the problem has anything to do with the connection and it's varying by hunderds of digits as shown aboveĮDIT2: The 5V is changed to 3.3V as suggested and the ADC is asserted to be working fine using cubeMX and HAL code (No damage from the 5V the ADC_DR in the HAL code is constant with the correct value) Str r0, the first (and only channel to be channel 5 (ADC_IN5 = PA0) Orr r0, #(1 << 0) (sequence legnth) Bits Str r0, voltage regulator average wake up time is 20us wait for r0, =4000īne the number of ADC conversion to be single conversion Str r0, the ADC voltage regulator ADVREGEN The 4095 is the intended result for me as the multimeter shows 5v however the result goes back to arbitarly value under 2k without no instructions executed in between tried to raise the Sampling time to 24.5 clock cycles with no luckī clock source for the ADC (Mandatory) else no clock The gdb output of the ADC_DR register shows the result of the ADC conversion changes to a wrong value immediately after reading it and stays that way (gdb) x/d &ADC_DR ![]() I set the pot to output 5v (asserted with a multimeter) and used the result to control PWM duty cylcle on an LED However the glowing of the led seemed constant (no changes in the duty cycle by varying the pot) However the ADC seems to give a wrong results I am using a NUCLEO-L432KC board DATASHEET I am trying to configure the ADC conversion with a 10k potentiometer ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |