2024-07-27 10:11 AM - edited 2024-07-27 10:11 AM
Here's the definition of some functions that is used to allocate variable in D3 SRAM.
typedef struct {
uint16_t PackType;
uint8_t Data[8];
uint8_t reserved[2];
}PinBasePack;
#define sMemory(mem,type) ((type *)(sMem(&mem,sizeof(type))))
typedef struct {
size_t heapPointer;
}MemoryController;
void* sMem(MemoryController* mc, size_t size) {
if (size > 4) {
size_t alignment = 4; // 4Byte Align
mc->heapPointer = (mc->heapPointer + (alignment - 1)) & ~(alignment - 1);
}
void* ptr = (void*)(mc->heapPointer);
mc->heapPointer += size;
memset(ptr,0,size);
return ptr;
}
MemoryController RD3 = {
.heapPointer = 0x38000000+0x1000,
};
PinBasePack *DMASyncTX = 0;
PinBasePack *DMASyncRX = 0;
Here's the code under setup/main.
DMASyncTX = sMemory(RD3,PinBasePack);
DMASyncRX = sMemory(RD3,PinBasePack);
HAL_SPI_TransmitReceive_DMA(&hspi6, (uint8_t *)DMASyncTX, (uint8_t*)DMASyncRX, sizeof(PinBasePack));
DMASyncRX can be overwritten by BDMA using CubeIDE, but nothing happened using Arduino.
I checked all configurations of SPI6 and BDMA are the same (even watching the values of SPI6 and BDMA).
The counter of hdma_spi6_rx is changing in both CubeIDE and Arduino.
Any clue for this difficult miscellaneous problem?:thinking_face:
2024-07-28 04:33 AM
Hi @thisdp ,
You need to check how linker is setup and compare the addresses of buffers if same inside SRAM areas.
Hope it helps ,
STOne-32