2025-04-10 12:49 PM
Hi,
Using Wise studio Version: 1.3.1_R Build id: 2023_05 on Linux with the STEVAL-IDB012V1 (BlueRNG-LPS dev. kit). I am trying to make the DMA sending a series of bytes to the lowest byte of the GPIOB output. The goal is to see a binary sequence appear on PB0 and PB1. I filled the buffer "buffer" with values where bit 0 and 1 are changing. Then, I call the two functions depicted below but nothing happens on PB0 and PB1. I already verified that the counter is counting and the GPIO can drive different values on PB0 and PB1. So I think my problem is in the DMA settings.
#define BUFFER_LENGTH 1400
#define PERIOD_50_US 3200 // 50us from 64Mhz timer 16
uint8_t buffer[BUFFER_LENGTH];
void My_GPIO_Settings()
{
GPIOA->MODER =0x000000A0;
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_0, LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT);
}
void DMA_Based_Waveform_Settings()
{
// Setting DMA channel
MODIFY_REG(RCC->AHBENR, 0, 1); // Enable the clock for DMA and DMAMUX
LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_8);
LL_DMA_ConfigAddresses(DMA1, LL_DMA_CHANNEL_8, (uint32_t)buffer, (uint32_t)&GPIOB->ODR, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_8, BUFFER_LENGTH);
LL_DMA_ConfigTransfer(DMA1, LL_DMA_CHANNEL_8, LL_DMA_DIRECTION_MEMORY_TO_PERIPH
| LL_DMA_MODE_CIRCULAR
| LL_DMA_PERIPH_NOINCREMENT
| LL_DMA_MEMORY_INCREMENT
| LL_DMA_PDATAALIGN_BYTE
| LL_DMA_MDATAALIGN_BYTE
| LL_DMA_PRIORITY_VERYHIGH);
// Setting timer to clock the DMA
MODIFY_REG(RCC->APB0ENR, 0, 7); // Enable the clock for TIMs
TIM16->ARR = PERIOD_50_US; // 3200
TIM16->DIER = 0x100; // Update DMA request enabled
// Setting the DMA MUX to make TIM16 clock the DMA transfer
LL_DMAMUX_SetRequestID(DMAMUX1, LL_DMAMUX_CHANNEL_7, LL_DMAMUX_REQ_TIM16_UP);
// Starting the transfer
LL_TIM_EnableCounter(TIM16);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_8);
}