AnsweredAssumed Answered

mi_initialize (raw_dma) - Missing SSYNC instructions?

Question asked by alemannia on Nov 28, 2011
Latest reply on Dec 5, 2011 by alemannia

Hi,

 

I am still struggling with an issue on a custom board with an BF537 (rev 0.2). The main problem is that after a watchdog reset by firmware gets stuck in the bootloader part (excuted from FLASH). Anyway, while trying to find out the cause I looked into the source code of the mi_initialize function. This function calls the raw_dma function in order to copy data from flash into the L1 memory. I am surprised to see that the raw_dma function doesn't use the SSYNC instruction while manipulating DMA registers.  Correct me if I am wrong but the following code is dangerous on a BF processor:

 

src0->x_count = count;
dst0->x_count = count;
src0->config = src_ctrl;
dst0->config = dst_ctrl;
idle(); // wait for interrupt

 

where src0, dst0 are pointers to DMA registers. Isn't it possible that the core decides to execute the IDLE instruction before write to the config register? Or even execute the write to the config register before the write to the count register? I am asking all this because in my case the bootloader stays in the IDLE instruction until I hit the break button on my IDE. I my opinion the code shoud look like this:

 

src0->x_count = count;
dst0->x_count = count;
ssync();
src0->config = src_ctrl;
dst0->config = dst_ctrl;
ssync();
idle(); // wait for interrupt
Cheers.

Attachments

Outcomes