Thanks for your response. After some testing and a little more development I have come up with a solution that half does what I want. I think it is acceptable for SCLK to keep running, it is TX_WS I am interested in manipulating.
What I am trying to achieve is (in the following order):
1) TX_WS and SCLK operating as normal. TX_WS at 10KHz and SCLK at 640KHz.
2) An asynchronous external event occurs which calls for the following to happen:
a) TIMER2 is started
b) TX_WS stops after it’s current cycle
c) TX_WS is then restarted once TIMER2 matches a certain value
The purpose of this is to have TX_WS rising edge synchronised with the external event, even though it starts one to two cycles afterwards, ie exactly 0.1ms or 0.2ms after the external event. Our client expects the samples from the ADC to be done in this way.
I have been able to achieve this in part, by setting the reset bit in the I2S DAO register and starting TIMER2. Once TIMER2 matches the count value it triggers an interrupt which unsets the reset bit in the I2S DAO register and starts TX_WS up again.
It is part 2a that I am now struggling with. As soon as I set the reset bit in DAO the TX_WS signal goes low so I lose that sample. Is there a way to have TX_WS complete it’s current cycle?
I hope that is a little clearer.