Hello again, I migrated the acceleration example project to my hardware, but unfortunately it does not work correctly... I can see that in lines 921+922 of module bma4.c: rslt = bma4_read_regs(BMA4_INTERNAL_STAT, &config_stream_status, 1, dev); config_stream_status = config_stream_status & BMA4_CONFIG_STREAM_MESSAGE_MSK; the content of variable config_stream_status is 0 after execution of function bma4_read_regs(...). This seems to signal an error. Sorry, but I do not exactly understand what this function does, but I believe it could be a problem of my implementation of functions user_spi_read(...) and user_spi_write(...). I implemented the following code by use of HAL SPI functions. Could you please check if there is something wrong ? I assume the code in user_spi_write() is possibly not correct. On call of the function I first transmit one byte of adress data, after the register data with given length. Is that okay ?! /*! * @brief Function for writing the sensor's registers through SPI bus. */ int8_t user_spi_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t length, void *intf_ptr) { /* Implement the SPI write routine according to the target machine. */ HAL_GPIO_WritePin(SPI2_ACC_NSS_GPIO_Port,SPI2_ACC_NSS_Pin,GPIO_PIN_RESET); // NSS Pin = Low HAL_SPI_Transmit(&hspi2,®_addr,1,100); // Transmit Register Adress HAL_SPI_Transmit(&hspi2,(uint8_t *)reg_data,length,100); // Transmit Data HAL_GPIO_WritePin(SPI2_ACC_NSS_GPIO_Port,SPI2_ACC_NSS_Pin,GPIO_PIN_SET); // NSS Pin = High return 0; } /*! * @brief Function for reading the sensor's registers through SPI bus. */ int8_t user_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t length, void *intf_ptr) { /* Implement the SPI read routine according to the target machine. */ HAL_GPIO_WritePin(SPI2_ACC_NSS_GPIO_Port,SPI2_ACC_NSS_Pin,GPIO_PIN_RESET); // NSS Pin = Low HAL_SPI_TransmitReceive(&hspi2,®_addr,reg_data,length,100); HAL_GPIO_WritePin(SPI2_ACC_NSS_GPIO_Port,SPI2_ACC_NSS_Pin,GPIO_PIN_SET); // NSS Pin = High return 0; } Thank you in advance, kind regards Harald
... View more