2014-03-04 08:37 PM
Something wrong with dspi ?
I have try debug with code for spi output signal with dspi module, it's not running. need some advidethis my code init :void initDSPI(void){ SIU.ISEL2.R = 0x0; DSPI_B.MCR.R = 0x80010000; // Configure DSPI_B as master DSPI_B.CTAR0.R = 0x78003255;; // Configure CTAR0 //DSPI_B.MCR.B.HALT = 0x0; // Exit HALT mode: go from STOPPED to RUNNING state SIU.PCR102.R = 0x0600; // DSPI_B_SCK SIU.PCR103.R = 0x0500; // DSPI_B_SIN SIU.PCR104.R = 0x0600; // DSPI_B_SOUT SIU.PCR105.R = 0x0600; // DSPI_B_PCS[0]}and this one is code function, it's call in main program :uint8_t EEPROM_WRITE_CMD(uint8_t cCmd, uint8_t cData){ uint8_t iloop; if(cCmd == 1){ EEPROM_CS = EEPROM_ON; DSPI_B.PUSHR.R = 0x08010000 | cData; for(iloop=0;iloop<0xFF;iloop++); EEPROM_CS = EEPROM_OFF; return 0; } return 1;}thank youWaivut J.2014-03-10 03:36 AM
2014-03-10 11:58 PM
Hi,
Thank youfor your advice. I found the problem now, I forgot to setslew rate control in siu_pcr for sck, sout and sin. and now spi is working. ps. I used spc563m64 for my project. Best regards Waivut J.2014-08-19 07:08 AM
I have a similar problem with SPI on a SPC560D discovery board. I tired to understand the DSPI test application for the discovery board, but it seems that there is no SPI output signal generated.
For testing purpose, I added following line to the test application to configure the DSPI input pin.SIU.
PCR
[12].
B
.
IBE
= 1;
//PA[12] Then, I connected output(PCR[13]) and input(PCR[12]) and used the commandspiExchange(&SPID1, 32, txbuf, rxbuf);
to send the content of the txbuf variable (as it is already done in the test application). For my understanding the variable rxbuf should afterwards have the same content as txbuf within the first 32 elements. But in my case, the first 32 entries of rxbuf have the value 0xFF. By the way, I found an error in the User Manual UM1681 for the SPC560D-DIS discovery board. The pinning of the I/O header shown in table 4 is not the same as shown in figure 14. There is at least one error e.g. at connector X2, pin 31. In the table it is PF[13] but in the figure it is PA[13]. Best regards, Patrik