All in all, this is a bit of a puzzle, especially as this code worked fine on the DG128. I would welcome any suggestions!
Steve.
dog wrote:These are read modify write operations. What set bit actually does is read the register, OR the mask byte in the instruction with it and then write the result back to the register....At the C level don't use bit field assignments and don't use |= with a bit mask, stick to plain old assignment with the bit mask, e.g. FlagRegister = 0x40;
peg wrote:Hi Dog,It would seem our clever chip designers are actually on to this, making write 1 to acknowledge bits read as 0. Do you know of specific instances where they have failed to do this?
Regards
While it doesn't say anything about a read-modify-write in the text describing this, the Access Details does show this. For all addressing modes a 'r' is present indicating an 8-bit read. It would be nice for them to state it in the description of the command as they do in the HCS08 Reference Manual(Which also contains a section on the BSET and BCLR commands).
sjmelnikoff wrote:Unfortunately, as mentioned above, this is not how the instruction is implemented on the HCS12. It appears to be implemented as a read-modify-write, which is implied, though not stated explicity, in the CPU reference manual (S12CPUV2 rev 4.0, p140), where it describes the operation as:
JimDon wrote:
Are proposing an new kind of memory that is bit addressable - because in this architecture io registers appear as memory.
I've seen processors with instructions like that, but in the end they still have to read at least a byte of memory to do that. If you look at the guts of a memory array, they only decode to the byte level. Wide memories access more than a byte.Funny you should mention that, as we're doing some work with the STM32 processor, and it does indeed have bit-addressable memory, of a sort.
I believe that IS the problem. Inadvertantly clearing a flag.
BigMac wrote:
However, there might be a potential problem if a bset instruction was used to set a bit, other than the flag bit - the flag could be unintentionally cleared.
Please try the following tip:I remember similar problem with SPI after migration from old Dx256B to newer Dx256 device.
Please try to read SPISR register immediately after reset before writing to SPI config. registers:
(void)SPI1SR; // SPISR init
Unfortunately this problem is not documented yet.
You could add this line also after SPI configuration is completed before the first writing to SPIDR register.