Part Number: C2000WARE
Hi!
I was wondering, how best to "schedule" read/write operations in the IPC if I want to write/read multiple different variables from CPU1 to CPU2.
For example, if I want to write 3 ADC measurements from CPU1 to CPU2, how do I write these to ensure they are read in order in CPU2?
Is it a case of needing to synchronise the ISR's of both CPU's, such that every time CPU2 reads data, we can ensure that the next variable to be read has been inserted into the IPCDATA register?
If they aren't in synch, is it possible that for example, my CPU2 could read the same data twice and assign them both to different variables, meaning my variable contains the wrong data?
I can think of one way to do this, which is to write data and address, set an IPC high, and read data from the registers in CPU2 and set them low again. This is repeated for every other variable to ensure that only one variable is written/wrote at any one time. I assume that this is the only way to send multiple pieces of information using IPC, and there is no way to write multiple pieces of data at once?
Pseudocode:
CPU1 writes data and address, sets IPCX pin high
CPU2 reads data and address from CPU1, sets IPCX pin low
CPU1 waits until IPCX is set low
CPU1 writes data 2 and address 2, sets IPCX pin high,
CPU2 reads data 2 and address 2, sets IPXC pin low. And so on, for every variable.
As you can see, this may seem quite inefficient and wasteful in terms of CPU cycles to read and write info, but the data sheet does seem to indicate that this is the only way to do it!
My device is the F2837xD.
Thanks in advance,
Joel