I am using atsam4e8c to interact with sensors through SPI. Whenever a data is written in spi_tdr, in the spi_rdr in the debug window shows 0xff and also MISO line is high. Also the SPI_SR, RDRF: Receive Data Register Full is 0. Please let me know is this related to clock or board init or sysclk init because the led is always blinking in the interval of 20seconds even there is no code to blink the led. Thank you in advance.
:
Edited by User
Reading spi_RDR in debug window is potentially harmful: This is a hardware register where reading has side effects! While you are debugging SPI code, save those registers into a variable that you can safely read with the debugger.
Even if I read in a variable, value still remains in the register. I would like to know why is this issue coming. I have configured the atsam4e8c in master mode. Even though the address to read the chip id of sensor is sent, a value of 0xff is there in the receive register and not getting cleared during debug. Once I start a new debug session,proper reset value is there. Thank you in advance.
Aditya K. wrote: > Even though the address to read the chip id of > sensor is sent, a value of 0xff is there in the receive register and not > getting cleared during debug. Why should RDR get cleared? SPI always sends and receives at the same time, so there will be the last transferred value in the RDR. Do you know that you usually have to transfer a dummy value to be able to read from the slave?
sorry I got confused.When the RDR is read,the RDRF bit should be cleared. In my case RDRF bit is not set. Yes if any data is required from the slave, a dummy value should be sent. In this case,I am trying to read the chip id and also other registers of slave by sending its corresponding address, even though the value received is 0xff. Please let me know what may be the issue.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.