6408 views|0 replies

9702

Posts

24

Resources
The OP
 

GD32E231C_START ADC code evaluation [Copy link]

This post was last edited by littleshrimp on 2019-3-21 20:11 Oversample_shift officially provides a peripheral library for GD32E230 because most of the functions of the two are the same. On the other hand, there is no other choice because there is no code for GD32E231. Use Examples\ADC under GD32E230_Firmware_Library_V1.0.0 to test it. Simply copy the corresponding file to Template in the project and it can run. At first, I tested the Temperature_Vref routine first, because it does not require external wires and is more convenient to use. After opening the routine with IDE, it can be compiled successfully at one time, which is very good for debugging. When running, you can see the temperature value change. When you heat the chip with your fingers, the temperature will rise. This proves that it is normal to read the data of the internal temperature sensor through ADC. Of course, it is normal for the temperature sensor inside the MCU to have an error of plus or minus 2 or 3 degrees Celsius, so it is not compared with other sensors Then I tested the Timer_trigger_injected_channel routine, but it didn't work after running. Judging from the name, it is a routine that uses timer to trigger sampling. I didn't find the option to read ADC data in the code. I don't know if this routine is not completed or has other uses. The DMA method of the Regular_channel_with_DMA routine to read the ADC is also normal The resolution routine also works normally with reduced resolution measurement The oversample_shift routine also works normally with oversampling adc_oversample_mode_config(ADC_OVERSAMPLING_ALL_CONVERT, ADC_OVERSAMPLING_SHIFT_4B, ADC_OVERSAMPLING_RATIO_MUL16); ADC_OVERSAMPLING_RATIO_MUL16 is the number of oversampling, ADC_OVERSAMPLING_SHIFT_4B is the number of bits to be discarded. If ADC_OVERSAMPLING_SHIFT_NONE is set, the ADC resolution is 16 bits. Setting ADC_OVERSAMPLING_SHIFT_4B reduces the resolution back to 12 bits, which can improve noise performance. The regular_channel_discontinuous_mode routine test is also normal Finally, I found another problem in the Analog_watchdog routine. The routine should be set by setting an ADC threshold, and then trigger an interrupt according to the measured value. After the interrupt is triggered, LED2 (corresponding to LED3 of GD32E231C_START) will light up for 3 seconds and then go out. In the actual test, LED3 is always on, regardless of whether ADC channel 2 is connected to power or ground. Using an oscilloscope to measure the LED waveform, there is a very short low-level breakpoint. I set it in ADC_CMP_IRQHandler and found that this interrupt will be triggered repeatedly. I don’t know if it is a problem with the program design.





This post is from GD32 MCU
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list