AnsweredAssumed Answered

STM32F103 - DMA Base Address Problem

Question asked by rohrauer.manuel on Jun 10, 2014
Latest reply on Jun 10, 2014 by Clive One
Hi Guys,

I've a bit of an understanding problem of the DMA in a STM32F103 µC.
I'm trying to set the base address to a pointer (not to an address of a static varialbe). My problem is, that if I set the pointer befor I use DMAInit(), all works. I I set the pointer afterwards, nothing works.

For me is clear, that the problem is, that I change the address fo the pointer, but the base address of the DMA is not changed. Is there a way, that I can use pointers with DMA base address or do I have to use static global array, which address can never be changed?

Some code may clarify what exactly my problem is.
typedef struct {
    uint8_t* pcTxBuffer;    ///< Pointer to sending buffer
    uint8_t* pcRxBuffer;    ///< Pointer to receiving buffer
} xI2CLibTransfer_t;
 
xI2CLibTransfer_t g_xI2CLibTransfer;
 
 
 
DMA_DeInit(DMA1_Channel6);
// ...
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t) g_xI2CLibTransfer.pcTxBuffer;
// ...
DMA_Init(DMA1_Channel6, &DMA_InitStructure);


If I set the pcTxBuffer befor the DMA initialization, all works (but I never am able to change it)
If I set the pcTxBuffer afterwards, the MemoryBaseAddr points to a wring address.

Is there any way I can make this happen with pointers?

Thank you very much,
Regargs
Manuel

Outcomes