![]() #define READ_REGISTER 0B01000000 // bit 6 set to 1 for read operationĭigitalWrite(csPin, HIGH) // set csPin to HIGH to prevent false trigger Your code send two bytes, 0x00 and 0x05, which is incorrect.įurthermore, based on page 78 of the datasheet, in order to read a register, bit 6 need to be set to 1 for a read operation, and 0 for a write operation. Secondly, according to datasheet page 85, to access the ID register, you send one-byte to specific which register that you need to communicate with. It is recommend to use use transactional SPI APIs which I have some explanation here. SPI.transfer(csPin,0x00) //Get data from Communication Registerįirst of all, this may not related to your question, but you are using old SPI methods setClockDivider(), setDataMode(), and setBitOrder() that has been deprecated since 2014. SPI.transfer(csPin,0x00,SPI_CONTINUE) //Tell Communication Register you are going to read ID register When i use it the code stops running at the Line: value = SPI.transfer(0x00) I found a solution in a Forum, but im not sure about why it differs with the data sheet: ![]() Im sending 0x00 and 0x05 to get back the 0x14 which should be the correct ID. You can find the registers on page 39 of the datasheet. I tried to to talk to the communication register to get the ID of my device from the ID register. ![]() I first used this library ( ), but decided to use a much easier Code to just make sure everything is working fine. Just the MISO dataline doesnt get me anything back. By using an Oscilloscope i made sure my Arduino sends data via MOSI, SCK and CS work aswell. ![]() I found several libraries, but i dont get anything back from my ADC modul. Refer to the official documentation for more information.I want to read data from AD7124-8 with arduino Due via SPI. Both can be used to inject your program on the board, however, it is recommended to use the programming port that works even if the MCU crashed before. These tutorials help you to write your first program with Arduino boards.Īs presented in the above image, the Arduino Due features two USB connectors: the programming port and native USB port. Some tutorials are available on the official Arduino web site. The open-source IDE can be downloaded for free (currently for Mac OS X, Windows, and Linux).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |