2009-01-20 03:08 PM
HardFault accessing variables in ISR
2011-05-17 04:00 AM
Hi,
I'm playing with an STM32-P103 from Olimex. I started with the ADC DMA example 1, ported it to the target board and removed the SPI functions (not needed for me). I have a structure; typedef struct { u16 dma_buf[ADC_BLEN]; u16 pipe[ADC_PIPE]; u16 head, tail; u16 status; u32 int_rms, rms; } adc_t; in main.h, and declare a variable adc_t adc; in main.c, and as extern adc_t adc; in stm32f10x_it.c. main.c has the needed stuff in the DMA setup I think.. DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address; DMA_InitStructure.DMA_MemoryBaseAddr = (u32) &(adc.dma_buf); DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; DMA_InitStructure.DMA_BufferSize = ADC_BLEN; Now, if I set ADC_BLEN to 512, it runs. If I set to 1024, I get a HardFault. I removed all references to the variable 'adc' from the DMA ISR, and still the same. I'm building with CodeSourcery tools, and it compiles and links cleanly with -Wall. Is there some problem, or limitation, WRT defining the buffer for DMA? Regards, James.2011-05-17 04:00 AM
I'll answer for me....I believe I simply ran out of RAM!