<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SPI and I2C losing synchronization after reset in S32K</title>
    <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634564#M22164</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;do your MCU properly run the application from flash after reset/power on?&lt;BR /&gt;Do you see right signals on SPI and I2C buses that a connected sensor's protocol&amp;nbsp;requires?&amp;nbsp;&lt;BR /&gt;If MCU run as master, the MCU initiates and controls communication and sensor/slave should respond accordingly.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
    <pubDate>Mon, 17 Apr 2023 09:49:49 GMT</pubDate>
    <dc:creator>PetrS</dc:creator>
    <dc:date>2023-04-17T09:49:49Z</dc:date>
    <item>
      <title>SPI and I2C losing synchronization after reset</title>
      <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634464#M22157</link>
      <description>&lt;P&gt;Hello everybody!&lt;/P&gt;&lt;P&gt;I am using a S32K144EVB to read some data from different sensors using both I2C and SPI communication protocols&lt;/P&gt;&lt;P&gt;The communication works fine until a press the reset button on the board or disconnect the board from the power supply. When the board is initialized, it loses the synchronization with the sensors and I am not able to read the data correctly anymore.&lt;/P&gt;&lt;P&gt;I have tried to program it using both the MBDT and the SDK, but I face the same problem in both environments.&lt;/P&gt;&lt;P&gt;May someone help me to understand what is going on, please?&lt;/P&gt;&lt;P&gt;I appreciate your assistance. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 07:56:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634464#M22157</guid>
      <dc:creator>kamilla_peixoto</dc:creator>
      <dc:date>2023-04-17T07:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and I2C losing synchronization after reset</title>
      <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634564#M22164</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;do your MCU properly run the application from flash after reset/power on?&lt;BR /&gt;Do you see right signals on SPI and I2C buses that a connected sensor's protocol&amp;nbsp;requires?&amp;nbsp;&lt;BR /&gt;If MCU run as master, the MCU initiates and controls communication and sensor/slave should respond accordingly.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 09:49:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634564#M22164</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2023-04-17T09:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and I2C losing synchronization after reset</title>
      <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634672#M22173</link>
      <description>&lt;P&gt;Thank you for your reply, Petr.&lt;/P&gt;&lt;P&gt;The MCU properly runs the application after the reset because I can see the data in FreeMaster and the LED also changes accordingly to the read data.&lt;/P&gt;&lt;P&gt;Using a data analyzer, I realized the data signals are shifted after the reset, so I usually miss a couple of bits, i.e. I have the same data being sent by the sensors, but they are not synchronized with the board anymore. Inserting a delay before initializing the pins and adding extra capacitors between the Vcc and GND helped, but didn't solve the problem completely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;The board runs as Master and I tried to add some delays (SCK to PCS, PCS to SCK and between transfers), but it also didn’t work.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 12:38:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1634672#M22173</guid>
      <dc:creator>kamilla_peixoto</dc:creator>
      <dc:date>2023-04-17T12:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and I2C losing synchronization after reset</title>
      <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1635984#M22217</link>
      <description>&lt;P&gt;The first picture shows the data as I am expecting, and the second data is what I get after pressing the "reset button". Basically, there is one bit missing, so all my data is shifted.&lt;/P&gt;&lt;P&gt;If I keep resetting it, I keep missing more bits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Including needed modules to compile this module/procedure */&lt;BR /&gt;#include "Cpu.h"&lt;BR /&gt;#include "clockMan1.h"&lt;BR /&gt;#include "pin_mux.h"&lt;BR /&gt;#include "Send.h"&lt;BR /&gt;#include "Receive.h"&lt;BR /&gt;#include "adConv1.h"&lt;BR /&gt;#include "PWM.h"&lt;BR /&gt;#include "osif1.h"&lt;BR /&gt;#include "dmaController1.h"&lt;BR /&gt;#if CPU_INIT_CONFIG&lt;BR /&gt;#include "Init_Config.h"&lt;BR /&gt;#endif&lt;BR /&gt;#define BUFFER_SIZE 2U&lt;BR /&gt;#define TIMEOUT 100U&lt;BR /&gt;volatile int exit_code = 0;&lt;BR /&gt;/* User includes (#include below this line is not maintained by Processor Expert) */&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdint.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdbool.h&amp;gt;&lt;/P&gt;&lt;P&gt;//Received Data&lt;BR /&gt;uint8_t masterDataReceive[BUFFER_SIZE];&lt;/P&gt;&lt;P&gt;//Status of the SPI transfer&lt;BR /&gt;status_t sts;&lt;/P&gt;&lt;P&gt;// Delay function&lt;BR /&gt;void delay(volatile int cycles)&lt;BR /&gt;{&lt;BR /&gt;/* Delay function - do nothing for a number of cycles */&lt;BR /&gt;while(cycles--);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*!&lt;BR /&gt;\brief The main function for the project.&lt;BR /&gt;\details The startup initialization sequence is the following:&lt;BR /&gt;* - __start (startup asm routine)&lt;BR /&gt;* - __init_hardware()&lt;BR /&gt;* - main()&lt;BR /&gt;* - PE_low_level_init()&lt;BR /&gt;* - Common_Init()&lt;BR /&gt;* - Peripherals_Init()&lt;BR /&gt;*/&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;/* Write your local variable definition here */&lt;/P&gt;&lt;P&gt;/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;BR /&gt;#ifdef PEX_RTOS_INIT&lt;BR /&gt;PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt;#endif&lt;BR /&gt;/*** End of Processor Expert internal initialization. ***/&lt;/P&gt;&lt;P&gt;ftm_state_t ftmStateStruct;&lt;BR /&gt;uint8_t masterDataSend[BUFFER_SIZE];&lt;/P&gt;&lt;P&gt;lpspi_state_t masterState;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Initialize pins&lt;BR /&gt;* - See PinSettings component for more info&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Initialize and configure clocks&lt;BR /&gt;* - see clock manager component for details&lt;BR /&gt;*/&lt;BR /&gt;CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,&lt;BR /&gt;g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);&lt;BR /&gt;CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LPSPI_DRV_MasterDeinit(0U);&lt;/P&gt;&lt;P&gt;delay(5000000);&lt;/P&gt;&lt;P&gt;lpspi_master_config_t MasterConfigSPI = {&lt;BR /&gt;.bitsPerSec = 100000U,&lt;BR /&gt;.whichPcs = LPSPI_PCS0,&lt;BR /&gt;.pcsPolarity = LPSPI_ACTIVE_LOW,&lt;BR /&gt;.isPcsContinuous = true,&lt;BR /&gt;.bitcount = 8U,&lt;BR /&gt;.lpspiSrcClk = 8000000U, //48000000U,&lt;BR /&gt;.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,&lt;BR /&gt;.clkPolarity = LPSPI_SCK_ACTIVE_HIGH,&lt;BR /&gt;.lsbFirst = false,&lt;BR /&gt;.transferType = LPSPI_USING_INTERRUPTS,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Initialize LPSPI0 (Send)*/&lt;BR /&gt;LPSPI_DRV_MasterInit(0U, &amp;amp;masterState, &amp;amp;MasterConfigSPI);&lt;BR /&gt;LPSPI_DRV_MasterSetDelay(0U, 10U, 10U, 10U);&lt;/P&gt;&lt;P&gt;/* Variable used for the loop that initializes the data buffer */&lt;BR /&gt;uint16_t i;&lt;/P&gt;&lt;P&gt;// Data to be sent&lt;/P&gt;&lt;P&gt;for (i = 0u; i &amp;lt; BUFFER_SIZE; i++)&lt;BR /&gt;{&lt;BR /&gt;masterDataSend[i] = 255u;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;sts= LPSPI_DRV_MasterTransferBlocking(0U, &amp;amp;masterDataSend, &amp;amp;masterDataReceive, BUFFER_SIZE, TIMEOUT);&lt;BR /&gt;delay(50000);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;/* Write your code here */&lt;BR /&gt;/* For example: for(;;) { } */&lt;/P&gt;&lt;P&gt;/*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;BR /&gt;/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt;#ifdef PEX_RTOS_START&lt;BR /&gt;PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt;#endif&lt;BR /&gt;/*** End of RTOS startup code. ***/&lt;BR /&gt;/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt;for(;;) {&lt;BR /&gt;if(exit_code != 0) {&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;return exit_code;&lt;BR /&gt;/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;BR /&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;P&gt;/* END main */&lt;BR /&gt;/*!&lt;BR /&gt;** @}&lt;BR /&gt;*/&lt;BR /&gt;/*&lt;BR /&gt;** ###################################################################&lt;BR /&gt;**&lt;BR /&gt;** This file was created by Processor Expert 10.1 [05.21]&lt;BR /&gt;** for the Freescale S32K series of microcontrollers.&lt;BR /&gt;**&lt;BR /&gt;** ###################################################################&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 07:36:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1635984#M22217</guid>
      <dc:creator>kamilla_peixoto</dc:creator>
      <dc:date>2023-04-19T07:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: SPI and I2C losing synchronization after reset</title>
      <link>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1637351#M22279</link>
      <description>&lt;P&gt;I could solve the problem by powering the sensor using a GPIO pin. Thus, I just turn it off and on again before entering the main loop.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 15:12:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/SPI-and-I2C-losing-synchronization-after-reset/m-p/1637351#M22279</guid>
      <dc:creator>kamilla_peixoto</dc:creator>
      <dc:date>2023-04-20T15:12:04Z</dc:date>
    </item>
  </channel>
</rss>

