Sorry it might be a dumb question but I couldn't find any assembler references for the esp8266.
So my question is how do I reset the ccount register in asm("")?
how to reset the ccount register?
Re: how to reset the ccount register?
Its possible you can't. I would also be nervous about re-setting its value even if we could. The ccount is a high speed register that I take to mean that it constantly increments. It is also a "global" (being a CPU register). There may be logic that has recorded the current value and is using that as timing to determine an elapsed duration which would be ccountNow - ccountRecorded. If you were to change the value of ccount, then that would break logic elsewhere.
Is there a specific reason that you want to reset it to zero? Can your logic not record its current value and perform arithmetic to determine elapsed time on a future read?
Is there a specific reason that you want to reset it to zero? Can your logic not record its current value and perform arithmetic to determine elapsed time on a future read?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: how to reset the ccount register?
Have you read https://esp32.com/viewtopic.php?t=293?
According to the xtensa ISA there is a wsr instruction, that would write to a special register.
You could try it out. What are you planning to use this for? If you plan to generate a signal RMT would be the way to go.
I do agree with Kolban, I don't think it is a register you are supposed to write to.
According to the xtensa ISA there is a wsr instruction, that would write to a special register.
You could try it out. What are you planning to use this for? If you plan to generate a signal RMT would be the way to go.
I do agree with Kolban, I don't think it is a register you are supposed to write to.
-
- Posts: 9761
- Joined: Thu Nov 26, 2015 4:08 am
Re: how to reset the ccount register?
To add to what's said above: If you do manage to write there, be aware that it probably breaks FreeRTOS: we use the ccompare functionality (which depends on ccount monotonically increasing) for scheduler timing, so resetting ccount will most likely break pre-emptive scheduling.
Who is online
Users browsing this forum: No registered users and 113 guests