Page 1 of 1

Flash Write / CPU Stall

Posted: Wed Dec 07, 2016 10:58 am
by Tabulous
When doing writes to flash(using ST Flash Lib) i.e. to update config variables, the OS will stall as there is a period of time where the Flash lib polls to ensure the operation was completed. This is just a while loop with a timeout of upto 0x2000 iterations.

These stalls can cause issues like buffer overflows on serial drivers etc......

So i was just wondering if anyone had come across this ?

Re: Flash Write / CPU Stall

Posted: Wed Dec 07, 2016 12:06 pm
by Giovanni
It should be fine but consider that interrupts are not being served, the impact has to be assessed for each IRQ source.

In the serial driver could cause some characters to be lost and you would get an overflow error on next interrupt. For SPI it would not matter much, you would get delayed notifications. For ADC streaming it would cause for missing callbacks but DMA would continue to fill buffers etc.

Giovanni

Re: Flash Write / CPU Stall

Posted: Wed Dec 07, 2016 2:28 pm
by Tabulous
Giovanni wrote:It should be fine but consider that interrupts are not being served, the impact has to be assessed for each IRQ source.

In the serial driver could cause some characters to be lost and you would get an overflow error on next interrupt. For SPI it would not matter much, you would get delayed notifications. For ADC streaming it would cause for missing callbacks but DMA would continue to fill buffers etc.

Giovanni


The serial driver is the one that is causing issues, as the interrupts cant be served, basically i get buffer overrun, now this is not down to the SD queue, its down to the hardware uart overruning the buffer/shift reg, but the SD driver reports the same SD_OVERRUN_ERROR for for queue and uart buffer. I dont know why this is done like this, but it means you cant tell unless you dig down what the error is.

Might be worth having a different error for queue overrun ?

Re: Flash Write / CPU Stall

Posted: Wed Dec 07, 2016 2:31 pm
by Giovanni
It is a good idea, it should definitely be a different error bit.

Giovanni

Re: Flash Write / CPU Stall

Posted: Wed Dec 07, 2016 2:48 pm
by Tabulous
Giovanni wrote:It is a good idea, it should definitely be a different error bit.

Giovanni


how about

#define CHN_QUEUE_FULL (eventflags_t)32

or

#define CHN_QUEUE_OVERRUN (eventflags_t)32


This leaves SD_OVERRUN_ERROR as an hardware shift register error only ?

Re: Flash Write / CPU Stall

Posted: Thu Jan 12, 2017 9:55 am
by Giovanni
Yes, will be that way.

Giovanni

Re: Flash Write / CPU Stall

Posted: Thu Jan 12, 2017 2:41 pm
by Giovanni
Hi,

Change committed on trunk.

Giovanni