In an effort to reduce the processing load on my 9S12X processors, I have moved modbus communication onto the XGATE processors using risc instructions, not C. It is difficult finding anyone who doesn't use C. Anyway, everything works fine, but after some time, say an hour, the communications all lock up. Sometimes the whole processor seems locked up, but sometimes it is just communications. I have thrown everything at this that I can think of. I have tried using semaphores where I can, but the buffers need to be used by both processors, and anyway, it should be timed so that the buffers aren't needed at the same time.
I guess the main question that I am most likely to get an answer to is: what happens when both processors try to access a variable at the same time? And is there a way to deal with such an error when it arises? My program requires for the unit to still run without communication, so I can't just reset when there is no communication, or else I would face the possibility of permanent resetting.
Any help offered would be greatly appreciated. I am in pretty deep.