LTC6811

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LTC6811

865 Views
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  

Tags (1)
0 Kudos
Reply
2 Replies

706 Views
saman001
Contributor II

Hi,

Thanks, I got it working now!

Kind regards 

0 Kudos
Reply

843 Views
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 Kudos
Reply