Hello,
I put the LM6517 in a board of my own design and the SPI reading and writing don’t work. I configured the chip in SPI with the MOD0 connected to ground and MOD1 floating. I put the schematic below. I originally had 5V on some digital inputs, so I used a fresh board and cut the traces by hand.
For pin 1, I considered the big dot under the markings. Is this the proper orientation for pin 1??? Can somebody please post a clear picture of the eval board zoomed in on the chip??? I put a picture of the PCB. I labelled in red the SPI signal names.
The datasheet says on page 22 to put a 300 ohm to 2k ohm resistor pull up to 3.3V. I put a 1.8k resistor on SDO once as a pull down to ground and once as a pull up to 3.3V. The SDO never drove the resistor at all in either way.
I plugged my board temporarily to an Arduino M0 Pro with Cortex M0 processor with full ARM debugging. I use hardware SPI.
I tried sending a few different values for the gain. I am not too confident for my transformer circuit that seems to be shorting out the function generator. That will go into another post.
I tried issuing a read command in mode 0 with 1MHz clock. I lower CS, send 0x80 and send one more time x80 as a dummy byte while I read. Next, I raise CS. The LMH6517 is not driving SDO. It stays high. I attached my logic analyzer capture and my Arduino code. For reference I put captures of the LMH617 datasheet relevant to the timing.
Does anyone see something wrong?
#include <Arduino.h> #include <Wire.h> #include <SPI.h> const int slaveSelectPinLmh6517 = 8; const int slaveSelectPinAd9958 = 5; void lmh6517RegularRead(){ volatile uint8_t instruction = B10000000; /*read for channel 0*/ volatile uint8_t value1; digitalWrite(slaveSelectPinLmh6517, LOW); delayMicroseconds(5); SPI.transfer(instruction); value1 = SPI.transfer(instruction); delayMicroseconds(5); digitalWrite(slaveSelectPinLmh6517, HIGH); delayMicroseconds(10); Serial.print(instruction); Serial.print(','); Serial.println(value1); } void lmh6517RegularWrite(uint8_t gainCode){ volatile uint8_t instruction = B00000000; /* Write to channel 0*/ digitalWrite(slaveSelectPinLmh6517, LOW); delayMicroseconds(5); SPI.transfer(instruction); SPI.transfer(gainCode); delayMicroseconds(5); digitalWrite(slaveSelectPinLmh6517, HIGH); delayMicroseconds(10); } void setup() { Serial.begin(9600); Serial.println("start"); pinMode(slaveSelectPinAd9958, OUTPUT); pinMode(slaveSelectPinLmh6517, OUTPUT); digitalWrite(slaveSelectPinAd9958, HIGH); digitalWrite(slaveSelectPinLmh6517, HIGH); SPI.begin(); SPI.setDataMode(SPI_MODE0) ; SPI.setBitOrder( MSBFIRST); SPI.setClockDivider(48) ; } void loop() { lmh6517RegularWrite(0xF0); lmh6517RegularRead(); delayMicroseconds(200); }
Thanks,
Frank