Hello,
im trying to communicate with an AFE4490 via SPI. For now my setup looks like this: i removed the Resistors R29, R31, R33 and R35 on the EVB and attached cables to connect them to my uC. I tried it with an Bluegiga BLE112 and now with an Arduino Uno. No success so far. The only feedback i got, was a short blinking of the Red LED when doing a Soft-Reset by seting the D3 Bit in CONTROL0 Register high. when I perform that in a loop, the LED glows, but not very bright. But writing in other Registers seems to fail. Im trying to set all registers to the default values exported from the EVB GUI. So timing and LED current etc should be fine. But nothing happens. Reading Registers returns 0. These are the results i get with an SPI configuration with SPIMode = 1( CPOL = 0, CPHA = 1) , Bitorder: MSB First. Other configurations failed. Clock is 4MHz.
So my Questions are:
1. is my output Voltage of the Arduino Uno of 5V too high for the SPI communication with the AFE? I think in the datasheet, the logic high input voltage is named with 0.75 * RX_DIG_SUP whitch would on the EVB be ca. 2,5V.
2. Are my SPI configurations correct? (SPIMode, Bitorder, Clock)
3. Do I write or read the Registers wrong? Here the Code(Arduino):
void AFE4400::SPIWriteReg(byte regAddress, uint32_t regValue){ byte temp_byte = 0; digitalWrite(chipSelectPin, LOW); SPI.transfer(regAddress & 0xFF); temp_byte = regValue >> 16; SPI.transfer(temp_byte & 0xFF); temp_byte = regValue >> 8; SPI.transfer(temp_byte & 0xFF); temp_byte = regValue; SPI.transfer(temp_byte & 0xFF); digitalWrite(chipSelectPin, HIGH); }
and for reading:
uint32_t AFE4400::SPIReadReg(byte regAddress){ byte temp_byte = 0; uint32_t reg_value = 0; // enable reading from registers SPIEnableRead(); digitalWrite(chipSelectPin, LOW); SPI.transfer(regAddress); // get first byte temp_byte = SPI.transfer(0x00); reg_value = temp_byte << 16; // get second byte temp_byte = SPI.transfer(0x00); reg_value = temp_byte << 8; // get last byte temp_byte = SPI.transfer(0x00); digitalWrite(chipSelectPin, HIGH); // disable reading from registers SPIDisableRead(); return reg_value; }
void AFE4400::SPIEnableRead() { SPIWriteReg(CONTROL0, 0x01); delay(1); }
And why ist the LED glowing when doing the soft reset? Do I need to attach more pins to my uC? Things like the !Reset are high anyway by default on the EVM right?
I hope you can help me, because Im running out of ideas what could be wrong.
Regards Marius