This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPIM3 sending wrong data/byte

I am using SPIM3 to drive a peripheral, only using tx. And I noticed that SPI is sending wrong/corrupt bytes once in a while. See below image where the code tries to send 0x12 but 0x00 goes through the wire. 

I am using below code to send the data where I have a  struct keeping the the data(pointer to it) and length of it. After each transfer (spi transfer ended event) i increment cursor to point the next chunk.. (some of the chunks are longer than 255)

static bool sendBuffer(void){
	xfer_desc.p_tx_buffer 	= epd_driver_state.buff[ epd_driver_state.cursor ].buffer;
	xfer_desc.tx_length 	= epd_driver_state.buff[ epd_driver_state.cursor ].bufferLen;
	spi_sending = true;
	APP_ERROR_CHECK(nrfx_spim_xfer_dcx(&spiM, &xfer_desc, 0, epd_driver_state.buff[ epd_driver_state.cursor ].hasCmd));
}

I have several questions, first, I am wondering what could be wrong with the corrupt byte. Also note MOSI hanging high after the preceding byte, I don't know if it is related..

Second question is whether I am doing something wrong by sending data that is longer than 255 bytes. I read about spi, easyDMA etc. but cannot say that I really understood it. 

Parents Reply Children
No Data
Related