SPI communication with TLE7242 chip

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

SPI communication with TLE7242 chip

1,160 Views
marceli1
Contributor III

I can not get communication with TLE7242 (4 Channel Fixed Frequency Constant Current Control IC)
 using MKL25Z processor driver using Processor Expert.SM1.jpg

I was trying using interrupt as well polling methods,

PWMSPIPtr = SM1_Init(NULL);

RESET_OUT_ClrVal();  // Toggle Reset TLE7242
 status.SM1_SendFlag = TRUE;
 RESET_OUT_SetVal();
 ENABLE_SetVal();

for(;;)

{

Error = SM1_ReceiveBlock(PWMSPIPtr, SPIData.InpBuffer, SPI_SIZE); /* Request data block reception */
Error = SM1_SendBlock(PWMSPIPtr, SPIData.OutBuffer, SPI_SIZE); /* Start transmission/reception */
 while (!SM1_GetBlockReceivedStatus(PWMSPIPtr))
 { /* Wait until data block is transmitted/received */
  SM1_Main(PWMSPIPtr);
  }

Labels (1)
0 Kudos
5 Replies

899 Views
marceli1
Contributor III

Hi Kerry,

I am using LTC2634 DAC in MSOP package, which has only SDI input, however it is using SPI MOSI only for data transfer should be enough. Accordance to Datasheet, I have selected Clock phase "Capture on leading edge", means shift clock edge on "falling edge" set. However, I must toggle Chip select in PEx, which transmission "byte by byte" seems be accepted but demo_spi clock setup is different. DAC can read single data here but is getting confused when changing channel number. Looks I can not use SPI for this DAC, seems need change to relevant I2C DAC.

Thank you,

Marceli

0 Kudos

899 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marceli,

   I am not familiar with your LTC2634 chip, but if you want to use the SPI, because that chip have the CS control flow, so I suggest you don't use the SPI_CS pin function directly in the KL25, but use the GPIO to control it, then it won't be toggle CS pin byte by byte. Just use the GPIO code to control the CS pin, this method won't have the byte by byte CS toggle problem.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

899 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marceli Firlej,

   Do have checked the SPI bus wave on your side?

   I suggest you use the GPIO to control the SPI_CS, instead of the SPI hardware CS function.

  Because as I know, some external SPI slave need the special CS control flow, you need to check your TLE7242 datasheet, just make sure your SPI send out the wave meet your external SPI slave chip's demand.

  I don't know what the IDE you are using now, but the KL25 SPI PE code, in the official website, there has a KL25 SPI CW  PE project for your reference:

https://www.nxp.com/downloads/en/lab-test-software/KL25_SC.exe 

Code folder:

kl25_sc_rev10\klxx-sc-pex\projects\spi_demo\cw

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

899 Views
marceli1
Contributor III

Thank you for the help, however I have resigned from using TLE7242 chip as not reliable communication with. Instead I am driving from KL25Z micro with PWM directly High Switch chip for valve solenoid. SPI in Processor Expert makes me more troubles, now I have to drive "3-wire MICROWIRE" DAC chip LTC2634 but is not getting data. Does I still need receive bytes if input is not enable?

Regards,

Marceli

0 Kudos

899 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Marceli Firlej,

     What 3 wire you need to use? I checked the LTC2634, it also have SDI, SDO, SCK, CS pin.

https://www.analog.com/media/en/technical-documentation/data-sheets/ltc2634.pdf 

   Do you mean, you just want to send out the data to the MOSI pin in the KL25, and you don't need to get the MISO data? If yes, you don't need to configure the MISO pin, just send the data out is OK, and don't read the SPI MISO pin.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------