Flash Write / CPU Stall Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Flash Write / CPU Stall

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Flash Write / CPU Stall

Post 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
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Flash Write / CPU Stall

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Flash Write / CPU Stall

Post by Giovanni »

It is a good idea, it should definitely be a different error bit.

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Flash Write / CPU Stall

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Flash Write / CPU Stall

Post by Giovanni »

Yes, will be that way.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Flash Write / CPU Stall

Post by Giovanni »

Hi,

Change committed on trunk.

Giovanni
Post Reply