LTC6811

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LTC6811

770 次查看
saman001
Contributor II

HI All,

my code for interfacing the LTC6811 doesnt work.

I use the same code with STM32 microcontroller and it works in that platform however for some reasons it doesnt work with S32K. 

I use lpspi_drv_mastertransferblocking for data transmit and receive however it seems this function does not control the CS pin as it should. 

could you please guide me through or if you have a sample code that would be appreciated.

Kind regards  

标记 (1)
0 项奖励
回复
2 回复数

611 次查看
saman001
Contributor II

Hi,

Thanks, I got it working now!

Kind regards 

0 项奖励
回复

748 次查看
ramprakash08
Contributor IV

Based on your description, it seems like you're having trouble interfacing the LTC6811 with the S32K microcontroller using the lpspi_drv_mastertransferblocking function for data transmission and reception. You mentioned that this function does not seem to control the CS pin as it should.

Firstly, it's important to note that the lpspi_drv_mastertransferblocking function is a blocking function that returns only when the transmission is complete. This function uses a blocking mechanism which means it will block the execution until the transfer is complete.

Regarding the control of the CS pin, the LPSPI peripheral does not control this pin directly. You need to manually control the CS pin using GPIO before and after the SPI transfer. Here is a simple example:

     /* Select the slave device */     GPIO_DRV_ClearPinOutput(your_CS_pin);
/* Transfer data */ lpspi_status_t status = LPSPI_DRV_MasterTransferBlocking(instance, &masterTransfer);
/* Deselect the slave device */ GPIO_DRV_SetPinOutput(your_CS_pin);

Please replace 'your_CS_pin' with the actual pin number you're using for the CS pin.

Also, make sure that the SPI settings (baud rate, clock polarity, clock phase, etc.) match between the LTC6811 and the S32K microcontroller.

0 项奖励
回复