help with this code, please
nicolad76
Posts: 164
Hi...I made my homework as suggested and I studied a little bit more...so I rewrote the code to drive my EInk display.
I have used Pasd (great!!!) to check the output of the pins...and it is correct (at least to me )...but it still doesn't work. Can anyone take a look and tell me what is wrong?
I cannot wait to see what I am doing that does let the display work....
Display uses a module which receives commands and data.
Commands flow is:
·1) reset device
·2) send command - start load data
·3) send all bytes to make 1 image (60.000 in 1 bit image)
·4) send command - stop load data
·5) show picture.
If bytes are not exactly 60000, than process fails.
Same flow in SPIN code...works!!!!
I can send the spec file of the module if you want...but to emails (on every page it says that I shouldn't publish that file).
Thanks
I have used Pasd (great!!!) to check the output of the pins...and it is correct (at least to me )...but it still doesn't work. Can anyone take a look and tell me what is wrong?
I cannot wait to see what I am doing that does let the display work....
Display uses a module which receives commands and data.
Commands flow is:
·1) reset device
·2) send command - start load data
·3) send all bytes to make 1 image (60.000 in 1 bit image)
·4) send command - stop load data
·5) show picture.
If bytes are not exactly 60000, than process fails.
Same flow in SPIN code...works!!!!
I can send the spec file of the module if you want...but to emails (on every page it says that I shouldn't publish that file).
Thanks
Comments
As far as I can see you never set the data bits in OUTA back to 0. Can you post the spin code that works if this doesn't help?
Steven
Probably not related but your ASM code sends the display command last and then keeps sending a display command (ret instruction still points to code after last writebyteCMD call, which is display).
Now, I don't know how your display copes with that (it may crash or enter an error state ...) Can you try adding a proper call to writebyteCMD and then enter an endless waitcnt loop?
I attached the working version written in SPIN. It is not professionally written but I need it to understand how that display works.
In the ASM version I have added some reset and init routine..same as SPIN version...
Do you have any idea what I am doing wrong?
Thank
Well, at the end there is now code, so the cog will attempt to execute data. It's better to put a small loop in there or do the equivalent of cogstop(cogid).
Anyway, I noticed that you have very small delay counts, e.g. 3 (at least 35ns), then you call code like this
The first instruction loads the current system counter, when waitcnt is executed CNT has advanced at least 4 cycles (add instruction). Meaning your 3 cycle delay will have to wait a full 32bit wrap around (~53sec) before waitcnt returns. I suggest using NOPs or skipping the waitcnt when the delay is below a certain threshold (e.g. everything below 20).
You are right...I have noticed that and replaced "delay" with "nop"...I also found another interesting bug..I was sending command byte in the wrong "direction"...starting from LSB instead of MSB...I fixed that too....but still no luck!!!!
I'll keep trying
Thanks!!!