Hi everyone. Currently I’m using RCM5700 to send and receive data via SPI, however when I try to transmit data (and read it in oscilloscope), it is always logic 1, regardless of what I am sending.
#define SPI_CLK_DIVISOR 100
//hold CS low for conversion time
for(i = 0;i < 10;i++)
BitWrPortI(PBDR, &PBDRShadow, 0, 7); // chip select low
temp = 0x00;
BitWrPortI(PBDR, &PBDRShadow, 1, 7); // chip select high
The weirdest thing is that when the printf is not there, the SCLK is also always logic 1 (as seen in oscilloscope).
You will need to set up the port pins correctly, direction and special functions etc. This is best done by modifying the brdInit() function in RCM57xx.LIB. You also need to make sure that one of the first things you do in main() is to call brdInit() to ensure all the i/o pins are in a consistent state.
Yes, it works already when i try to see the clock and the data I sent through SPI in oscilloscope. However, when I try to receive data through SPI, by giving a constant 3.3V to the RXB pin (I am using PORT B) and use printf to display the value, an error occurs. Previously, when I never give any input, the dynamic c will keep printing 0, and then when I put 3.3V to RXB, the dynamic c stop printing.
Which error occurrs when you hold SDI high?
try to use alternate config for PC4:
BitWrPortI(PCFR,&PCFRShadow,1,4); // Initialize PC4 to use alternate function -> complette l’init du SPI