Are you using a debugger (stlink) to see if you code is getting stuck somewhere or doing anything unexpected?
Performing an SPI transfer *in* the SPI transfer complete callback doesn't seem right to me (I think thats what it is). Try updating every 500ms or something instead.
Yes, i have used a stlink and i have checked if the code do some wrong. I am a begginer but i think that the code "working as expected" (i am not 100% sure).
First while loop, i send some text and one QR code to show in the e-paper. I do some tasks with the e-paper without problems. First cycle (first while loop), all work as expected. Next whiles loop (using and not using the stop mode as low power mode), the e-paper only show the last screen sent in the last loop. When i send something to the e-paper, the display show the last screen sent in last loop. Next commands sent to the e-paper, the display don´t show anything, next command show the last screen sent in the first loop. The rest of the code work as expected.
I don´t understood what do you want say here: Performing an SPI transfer *in* the SPI transfer complete callback doesn't seem right to me (I think thats what it is). Try updating every 500ms or something instead.
This is probably just a bad driver, or improper use of the driver. The driver expects the display to be in a certain state, which it isn't due to a previous command not being performed or being sent while busy.
You can check with a logic analyzer if the SPI still sends stuff, which I'm sure it does.
Verify if the display also has a busy bit, check this when waiting for it to do it's thing.
Also verify that you're not going to a sleep mode that loses register and ram contents that you do not expect to lose.
I have not a logic analyzer
I need buy one.
If the SPI had a conflict, why i dont get the problems in the first loop?
When the microcontroller wake-up, i do the init of SPI, but only work well at the first loop. I have tried with the stop mode and without the stop mode, but don´t work.
The e-paper only have a 3 SPI pins (MOSI, CLK, CS) and other pins as reset, busy, vcc, gnd... Between loops i turn off the VCC e-paper, so the hardware should be how the first cycle.
I am not sure about the library works well because if i disconnect the e-paper i dont get the init error.
How i could reset the microcontroller SPI interface? (if this is possible). This is not a good solution but could be a temporary solution.
Thanks,
Regards.