cancel
Showing results for 
Search instead for 
Did you mean: 

STM32, SPI communication and SX1280.

JL_Loyd
Associate

Dear everyone,

I'm trying to use a SX1280 for RF connectivity.
My dev board is the official... the SEMTECH "SX1280ED1ZHP", it's included a nucleo + daughter board with SX1280.

Capture d’écran 2024-11-28 143754.png

My diffculty is that a not able to read correctly a register with a know value after reset.
Second thing, a see Something wrong at scope.
So i'm here because a would like help.

 

#IOC Spi configuration

Capture d’écran 2024-11-28 143319.png

 

 

#Define

 

 

 

#define SX1280_SPI &hspi1
#define SX1280_NSS_PIN GPIO_PIN_8  // Replace with your NSS pin
#define SX1280_NSS_PORT GPIOA  // Replace with your NSS GPIO port
#define MANUAL_GAIN_REGISTER 0x0895

 

 

 

 

 #Read Function

 

 

 

#define MANUAL_GAIN_REGISTER 0x0895


  	  uint8_t SX1280_ReadRegister(uint16_t regAddr) {
      uint8_t command = 0x03;  // Read register command
      uint8_t addrHigh = (regAddr >> 8) & 0xFF;  // High byte of the register address
      uint8_t addrLow = regAddr & 0xFF;  // Low byte of the register address
      uint8_t dummy = 0x00;  // Dummy byte for clocking out the data
      uint8_t regValue = 0x00;  // Variable to store the register value

      HAL_GPIO_WritePin(SX1280_NSS_PORT, SX1280_NSS_PIN, GPIO_PIN_RESET);
      	  HAL_SPI_Transmit(SX1280_SPI, &command, 1, HAL_MAX_DELAY);
      	  HAL_SPI_Transmit(SX1280_SPI, &addrHigh, 1, HAL_MAX_DELAY);
          HAL_SPI_Transmit(SX1280_SPI, &addrLow, 1, HAL_MAX_DELAY);
      	  HAL_SPI_TransmitReceive(SX1280_SPI, &dummy, &regValue, 1, HAL_MAX_DELAY);
      HAL_GPIO_WritePin(SX1280_NSS_PORT, SX1280_NSS_PIN, GPIO_PIN_SET);
      return regValue;
  }

 

 

 

 

#Function Call

 

 

 

uint8_t manualGainValue = SX1280_ReadRegister(MANUAL_GAIN_REGISTER);

 

 

 

 My aim is to read the MANUAL_GAIN_REGISTER, at addr = 0x0895.
From the datasheet, the reset value must be 0x01.
The value received is 0x00.

 

TEK0001.JPG
Channel 1 : CS / Channel 2 : SCK

 

 

TEK0002.JPG

Channel 1 : MOSI / Channel 2 : SCK

 

 

TEK0003.JPG

Channel 1 : MISO / Channel 2 : SCK


if someone have an idea... thanks !

1 REPLY 1

@JL_Loyd wrote:

My dev board is the official... the SEMTECH "SX1280ED1ZHP", it's included a nucleo + daughter board !


Does that not come with some demo or example software?