As I said, RXIFG is still set from the previous for SPI transactions. You'd have to wait for the fourth byte to be received and then to clear RXIFG before doing the two actual reads. And it might be a better idea not to split the function into separate write+read parts; just write and read six bytes in both directions.
↧