Hi.
@Anthony: Thank you for the detailed answer in "N2HET: Update the bit field "Next program address"", http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/292095.aspx .
But now I would have additional questions regarding the consequences of updating the Program Field of an N2HET instruction through a CPU write access, in case the N2HET is turned ON (i.e. HETGCR.TO = 1):
1. Why there is no hint in the datasheet or the TRM (spnu499b.pdf) that such an access should not be done? Or I didn't find this hint.
2. The ADD, SUB, etc. instructions could update the bits [0..8] of the Program Field. If I understand it right, this is allowed, cause with this mechanism is assured, that the Program Field which will be udpated is currently not executed. Is this correct?
3. Assume the following HET program:
; At every start of a new LRP, an interrupt will be generated. L000: DJZ { next = L001, irq = ON, data = 0, ... } L001: CNT { next = L002, ... } ; Here are additional 98 instruction L002 to L099 in between, which will be executed under all circumstances. ; The Program Field of this BR instruction will be modified by a CPU write access. L100: BR { ... } ; Further instructions.
So at every LRP start, an interrupt will be generated, and in the called ISR will the Program Field of the BR instruction at L100 be written by a CPU write access. From this it follows that it is assured, that this BR instruction is not executed when its Program Field is updated.
Would this be already a problem for the N2HET module, or is this not a problem?
If it's a problem: What could happen?
4. Assume a CPU write access to a Program Field of an instruction happens. And at the very same point in time the same instruction will also be executed by the N2HET: What is the worst case which could happen?
Example 1: Assume this instruction is a BR instruction, and due to the CPU write access the bit field "Next program address" will be updated from LabelOLD to LabelNEW. IMHO the worst case is, that it could not be stated in advance if the N2HET will execute as next instruction the LabelOLD or LabelNEW. Or am I wrong?
Example 2: Assume this instruction is a PCNT instruction, and due to the CPU write access the bit field "Type select" will be updated from FALL2RISE to RISE2FALL. IMHO the worst case is, that it could not be stated in advance if the N2HET will stop counting on a rising edge (which occurred during the last LRP) or not. Or am I wrong?
Cause if these are the worst cases, for our needs this would not be a problem.
5. Is it possible that the N2HET could get stuck forever or some similar action (in case the Program Field of an instruction is updated by a CPU write access and the same instruction is executed at the same point in time by the N2HET)?
Would be great if someone can answer these questions.
Thank you and regards
Oliver.