Hi there,
To receive an asynchronous serial data stream from a NHET pin (1 Mpbs), I'm setting up the HTU in dual-buffer mode to transfer data from the NHET to the main memory with auto-switch mode turned ON, let say, with 10 elements in each buffer.
During normal operation there is no problem:
- BufferA full: interrupt to main CPU and next HTU transfer to BufferB automatically set
- BufferB full: interrupt to main CPU and next HTU transfer to BufferA automatically set
- In both cases, the CPU reads 10 elements at a time
However, given the asynchronous serial data nature, there is a case when the data stream stops for an indetermined lap of time (possibly will resume later but I don't know when) and I want to read and empty the buffer being written (to minimize delay and other performance reasons).
In the TMS570 reference manual (June 2010 Edition), page 1390, para. 19.2.1.4, it suggests that:
There could be a case where the CPU wants to do main memory operations, but does not want the HTU modifying the main memory. It could happen that a request was already active, but the frame transfer hasn’t started yet when the application disabled the control packets. The timing diagram in Figure 19-8 shows this scenario.
Since the request for the transfer was already received before the DCPx is disabled, the HTU will still start the frame transfer. The application would poll the BUSYx bit during the time the DCPx was disabled and before the frame was started and would read a non-busy information. It then would start the main memory operations thinking all transfers have completed, however after some time the HTU will start the outstanding frame transfer and corrupt the main memory.
To avoid this, the application can set the VBUSHOLD bit to disable all transactions between the HTU and the main memory. It has to poll the BUSBUSY bit to ensure that no outstanding transactions on the bus are pending. The HTU will still receive all transfer requests from the NHET, but it will not be able to transfer any data to or from the main memory, while the VBUSHOLD bit is set.
Questions:
-
It is not clear on the suggested order of operations here. Should I set VBUSHOLD or poll the BUSBUSY bit first?
-
If setting VBUSHOLD first, does this operation interrupt the currently transfer frame immediately, if any? This is a problem because it is a data loss condition.
-
If polling the BUSBUSY bit first, how can I ensure that between the polling of BUSBUSY and setting of VBUSHOLD there is no new initiated frame transfer?