risc-v/gd32vw55x: fix ADC reopen and add gd32vw553k-start adc example

adc_shutdown() gates the ADC clock (RCU_APB2EN.ADCEN) when the device is
closed, but the one-shot adc_reset() that first enabled it only runs at
registration and adc_setup() never re-enabled it. A second open() then drove
a clock-gated peripheral whose conversions never completed, so a second run of
a reader such as the adc example hung after opening the device. adc_setup()
now re-enables the ADC clock; clock gating preserves the register
configuration, so nothing else has to be re-programmed.

Add an "adc" configuration that exercises the driver. It is the nsh base plus
the ADC driver, registered as /dev/adc0 and read by the adc example. ADC
channel 8 (ADC_IN8) is routed to PB0 on the J1 header so an analog voltage
applied there is sampled. The board bringup samples that channel when the pin
is routed, and PB0 is only claimed for the ADC when SPI is off (with SPI on it
belongs to the I2C0 fallback), so the periph configuration is unaffected.

The GD32VW55x ADC converts on demand rather than continuously, so the example
uses the software trigger (CONFIG_EXAMPLES_ADC_SWTRIG) and is bounded to 20
sample groups so it returns to the prompt.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
5 files changed
tree: 31003869423909873341ba0a92986163b1eae020
  1. .github/
  2. arch/
  3. audio/
  4. binfmt/
  5. boards/
  6. cmake/
  7. crypto/
  8. Documentation/
  9. drivers/
  10. dummy/
  11. fs/
  12. graphics/
  13. include/
  14. libs/
  15. mm/
  16. net/
  17. openamp/
  18. pass1/
  19. sched/
  20. syscall/
  21. tools/
  22. video/
  23. wireless/
  24. .asf.yaml
  25. .codespell-ignore-lines
  26. .codespellrc
  27. .editorconfig
  28. .gitignore
  29. .gitmessage
  30. .pre-commit-config.yaml
  31. .yamllint
  32. AUTHORS
  33. CMakeLists.txt
  34. CONTRIBUTING.md
  35. INVIOLABLES.md
  36. Kconfig
  37. LICENSE
  38. Makefile
  39. NOTICE
  40. README.md
  41. ReleaseNotes
README.md

POSIX Badge License Issues Tracking Badge Contributors GitHub Build Badge Documentation Badge MemBrowse

Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).

For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.

Getting Started

First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.

Documentation

You can find the current NuttX documentation on the Documentation Page.

Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.

The old NuttX documentation is still available in the Apache wiki.

Supported Boards

NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.

Contributing

If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.

License

The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.