Configuring ADC directly on RAK3172

Hi,

I am new to RAK3172 and RUI. For my application, I need to configure the ADC to operate at maximum speed and use DMA to capture the data (i.e I want to use the full 2.5Msps capability of the STM32.)

The RUI ADC API is quite simple and doesn’t provide the level of access needed to do this.

How do I go about configuring the hardware directly from within RUI?

Thanks.

Welcome to the forum @dgiddy

RUI3 is not using DMA for the analog readings. But since RUI3 V4.1.0 the BSP is complete open source, so you might be able to dig into the hal layers and implement it.

@beegee thanks for the quick response. OK, that could be workable. Would the simplest approach be to extract the relevant files (including all the referenced .h files), modify them and add them to my RUI project, or will I run into compilation issues? Any other approach you would recommend?

Can you confirm that I’m looking at the correct files here? https://github.com/RAKWireless/RAK-STM32-RUI/tree/main/cores/STM32WLE/component/core/mcu/stm32wle5xx/uhal

Thanks.

I never tried to do such changes, but I think you have to change the files within the BSP itself, they have to be in the correct folder location.

The repo you pointed to is the correct one.

OK, that implies a fork of the repository and rebuilding the BSP. Are there any instructions on building the BSP available? i.e. what the toolchain is and any required environment setup?

That’s again something I didn’t try.

My approach would be to create a new JSON file for the installation and create a new downloadable ZIP/tar.gz release. Then in the JSON file the download path would point to your release.
For the JSON file, in the original package_rakwireless.com_rui_index.json you can find all the required tools and environment.

OK, got it. I was assuming that the BSP was pre-compiled, but it appears the parts I need are compiled in as needed, so that makes it much simpler. I’ll see how I go.

Thanks again.

On versions older than V4.1.0 parts of the BSP were pre-compiled.
Since V4.1.0 the whole source code is available in the BSP.