kywwilson11 opened a new pull request, #16557:
URL: https://github.com/apache/nuttx/pull/16557

   ## Summary
   
   This PR adds DMA support for the STM32G0 series in NuttX, with a focus on 
STM32G0B/C devices that include DMA2. It also enables ADC1 DMA functionality 
and corrects how sample times are handled for STM32G0 and STM32C0.
   
   Changes include:
   
   - Added Kconfig options:
     - `STM32F0L0G0_HAVE_DMA2`
     - `STM32F0L0G0_HAVE_DMAMUX1`
     - `STM32F0L0G0_HAVE_ADC1_DMA`
   - Defined DMA1/DMA2 and DMAMUX1 channel counts and base addresses specific 
to STM32G0B/C.
   - Completed and cleaned up the DMA request map.
   - Enabled ADC1 DMA integration with support for circular + continuous 
conversion.
   - Updated `adc_sample_time_s` to match STM32G0 architecture:
     - G0 and C0 only support two global sample times, which are selected 
per-channel using `SMPSEL`.
     - Individual per-channel sample times are not supported on this 
architecture.
   - Added `SMPR2` support for both STM32G0 and STM32C0.
   - Created `nucleo-g0b1re:adc_dma` defconfig to test ADC with DMA enabled.
   - Added IRQ and RCC support for DMA2.
   - Cleaned up conditional logic across STM32G0 sub-series using Table 1 in 
RM0444 and RM0454.
   
   ## Impact
   
   - Adds working DMA2 and DMAMUX1 support for STM32G0B1 and STM32G0C1 chips.
   - Enables DMA-based ADC sampling for STM32G0 and STM32C0.
   - Adds a testable configuration using continuous + circular mode.
   - Refactors ADC sample time logic to reflect actual STM32G0/C0 hardware 
behavior.
   - No impact on unsupported STM32G0 variants (e.g. G0A/G0K/G0X0).
   
   ## Testing
   
   **Host**: Ubuntu 24.04 (WSL2)  
   **Compiler**: arm-none-eabi-gcc 12.3.1  
   **Board**: NUCLEO-G0B1RE  
   **Config**: `nucleo-g0b1re:adc_dma`
   
   Tested using the `adc` shell command. 3.3V was applied to channel 0, with 
each channel successively dropping by 3.3V/4 by use of a resistor voltage 
divider:
   
   <pre>
   NuttShell (NSH) NuttX-12.9.0
   nsh> adc
   adc_main: g_adcstate.count: 1
   adc_main: Hardware initialized. Opening the ADC device: /dev/adc0
   Sample:
   1: channel: 0 value: 65520
   2: channel: 1 value: 43346
   3: channel: 4 value: 26942
   4: channel: 9 value: 13451
   nsh>
   </pre>
   
   Confirmed that `adc_dmaconvcallback()` was called, verifying DMA is in use. 
Without circular mode enabled, continuous conversions would overflow the buffer 
and freeze the shell. With both circular and continuous modes enabled, ADC 
sampling is stable and functions as expected.
   
   Let me know if this should be split into smaller commits or if any 
documentation should be added.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to