This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48 SPI2 Chip Select issue

Other Parts Discussed in Thread: RM48L950

Hello,

I am using the RM48L950 to communicate with a DAC eval board through SPI2.

The message I am trying to transmit is a 32 bit stream broken into two 16 bit blocks which should be transmitted one after the other while the chip select is held low until all 32 bits are sent.

I am getting sudden jumps on the SDI and CS lines that last for about 5ns.  Could someone help me understand what is causing the issue?

Here is my code and a picture of the scope where you can see the jumps (red = SDO, blue = CLK, purple = SDI, yellow = CS).

Thanks,

Rafael

spiDAT1_t dataconfig1_t;

uint16 datain[2] = {0x0000, 0x0000};

/* USER CODE END */

void UNI_SPI_setup(void)
{
/* USER CODE BEGIN (3) */

    dataconfig1_t.CS_HOLD = TRUE;
    dataconfig1_t.WDEL    = TRUE;
    dataconfig1_t.DFSEL   = SPI_FMT_0;
    dataconfig1_t.CSNR    = 0xFE;

	/* Enable IRQ */
	_enable_IRQ();

	/* Initialize SCI module */
	spiInit();

/* USER CODE END */
}

/* USER CODE BEGIN (4) */
void UNI_SPI_transmit(uint16 data[2])
{
	spiSendAndGetData(spiREG2, &dataconfig1_t, 2, data, datain);
}

  • Can you export the project to a zip file and attach it? The important thing is how your UNI_SPI_transmit() function is implemented. The first 16 bits are written to register SPIDAT1 with the proper CSN and CSHOLD=1, then the second 16 bits are written to SPIDAT1 with the same CSN but with CSHOLD=0. The CSN depends on which CS you are using.