I am communicating with a stack of 3 SPI boards in a daisy-chain configuration. Most of it is working but sending more than single byte commands is loosing the following data bytes. Some debugging has shown that I'm stamping on the tx buffer with writing to the rx buffer.
Looks like I messed up some pointer arithmetic in setting up the buffers.
// combine Tx and Rx arrays, set Rx pointer half way. #define BYTES (4) uint8_t spiTxBuffer[2*SPI_BYTES]; uint8_t ( *spiRxBuffer )  = spiTxBuffer +2;
Initially I had two separate buffers but I attempted to combine them in order to zero both buffers with a single memset(). There were many places where this was done some of which were in a critical code path. It also saved quite a bit of code space in an arduino that is full to the brim.
I am not looking for comments like I should not be doing it anyway. There may be other solutions. What I need to understand is how to use pointers in C which I find totally arcane. Despite lots of searching and reading, just about everything I thought was valid refused to compile. Thus compiles but apparently does not do what I intended.
The object was to have one contiguous buffer. The first half of which serves as tx buffer, the latter half as rx buffer. I need a pointer to the half way point that I can use to access the rx buffer , byte by byte.