Is it possible to make the pst faster than spin?
After some reading, it appears that the best one can expect from spin is a code execution every 350 to 400 clk cycles.
It is possible to get the pst to run faster than spin could run a simple method in a dedicated cog, to update global variables so you could have a dedicated pst cog that read longs and sent them to the terminal faster than another cog could update them through spin ... even in a simple spin repeat loop with 1 action? The loop below should run at ~ 200000hz to 250000hz on an 80mhz program, correct?
Spin dedicated cog loop
To keep up, it would have to send up to (12*9) ( bits at the same frequency to catch every single number, correct? If my math is correct, this isn't happening. pst is also theoretically limited by the clkspeed (as well as other factors) of the processor/machine it is running on, correct?
Thoughts?
It is possible to get the pst to run faster than spin could run a simple method in a dedicated cog, to update global variables so you could have a dedicated pst cog that read longs and sent them to the terminal faster than another cog could update them through spin ... even in a simple spin repeat loop with 1 action? The loop below should run at ~ 200000hz to 250000hz on an 80mhz program, correct?
Spin dedicated cog loop
VAR long l_a Pub spinLoop repeat l_a++
To keep up, it would have to send up to (12*9) ( bits at the same frequency to catch every single number, correct? If my math is correct, this isn't happening. pst is also theoretically limited by the clkspeed (as well as other factors) of the processor/machine it is running on, correct?
repeat pst.dec(l_a) pst.char(13)
Thoughts?
Comments
If you want the fasted speed possible from a serial connection, you'd probably want to have a PASM loop reading the values to transmit directly.
One of my modified four port drivers transmits an acknowledgement character when a wireless transmission is received. The acknowledgement never passes through the Spin interface so it happens much faster than it normally would.
The Spin interface is what make the objects easy to use though, so trying to bypass them will likely take a bit of work.
-Phil
The other day I was trying to trace something that counted from 1 to ~167.
I would have liked to have printed out every single counted value via a com cog to try and debug, but I did not attempt this because I didn't want the pst buffer to fill up because it is slow compared to spin, even at 115_200. I then tried to speed both of them up to the 921_600 setting and got gibberish.
Can you buffer up the data in RAM?
Maybe use a producer-consumer model, then shoot the data out the serial port when ready.
Anyway, sometimes ya just need to know what the heck was going on at some point in a process. I once spent 2 weeks trying to find a buffer overrun error in PASM. I did not know the buffer was smashing other memory. It took me a while to build tools and narrow down the culprit.
Point being, I had to come up with a systematic plan then execute the plan.
From your description, it sounds like you want to see 128 iterations of something. If so, you might consider writing all 128 values to some memory location. Then print the reading to the PST when the process has completed.
Thank you.
If so, with a single resistor and a tv, and a cog, you could output to a tv screen. See my debug_1pin tv object in OBEX.