S32K116 custom two wires serial communication implementation

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

S32K116 custom two wires serial communication implementation

Jump to solution
1,350 Views
NicoloStrozzi
Contributor III

Hello everyone,

I'm trying to implement a custom protocol on S32K116 to control an external IC. The communication is based on 2 wires protocol (SCLK and SDATA bus).  The communication will be bi-directional. The S32K116 will be the master in the communication. For reading operation the master will send a specific bit pattern then the slave take control of the SDATA bus responding with a bit stream. Unfortunatly because of several constraints (e.g., wake up strategy, sync bit, etc.) it does not fit to any standard protocol (SPI, UART, I2C, LIN, Manchester, etc.).  

I'm wondering which should be the suggested\ best approach to implement this protocol. My question is mainly related to the best practise to implement a custom bit-based protocol by using this specific microcontroller. Currently my project is driver-based with no realtiime OS.

Thank you in advance!  

0 Kudos
1 Solution
1,329 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@NicoloStrozzi

       As you said, your custom protocol  does not fit to any standard protocol (I2C),so I think that it is very difficult to use I2C module based on S32K116.

       What do you think of the way that simulate the protocol using the General Purpose Input Output(GPIOs) of the microcontroller,It seems that this method is best suited to meet your requirements.

 

Below file may help you know more about GPIO Simulated I2C protocol(two-wire serial communication).

https://www.nxp.com/search?keyword=AN12841&start=0&category=documents 

AN12841-GPIO Simulated I2C for S08: This application note introduces how to implement GPIO simulated I2C as a master based on S08PB/S08PLS.

 

BR!

     Jim,

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
----------------------------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
1,300 Views
NicoloStrozzi
Contributor III

  

0 Kudos
1,330 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@NicoloStrozzi

       As you said, your custom protocol  does not fit to any standard protocol (I2C),so I think that it is very difficult to use I2C module based on S32K116.

       What do you think of the way that simulate the protocol using the General Purpose Input Output(GPIOs) of the microcontroller,It seems that this method is best suited to meet your requirements.

 

Below file may help you know more about GPIO Simulated I2C protocol(two-wire serial communication).

https://www.nxp.com/search?keyword=AN12841&start=0&category=documents 

AN12841-GPIO Simulated I2C for S08: This application note introduces how to implement GPIO simulated I2C as a master based on S08PB/S08PLS.

 

BR!

     Jim,

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
----------------------------------------------------------------------------------------------------------------------------------------

1,282 Views
NicoloStrozzi
Contributor III

Hi Jim,

thank you very much, this is exactly what I was looking for.

 

I've some further question on "best practise" related to this application note:

-Is it mandatory to switch the GPIO between input\output when moving from read to write? As from the thread title I'm currently using a S32K116 microcontroller but I'm not able to find out if the GPIO pins are open-drain configured and if there is an internal pull-up resistor.

-In the application note the communication is made by implementing a SCL_delay function (which could be based on SW or HW timer) interposed between the consecutive pin set (SDA_high\SDA_low). Is it possible to use the HW timer to set the SCL and SDATA directly in the timer callback or is it suggested to use the application note approach, so using a "sleep" function and completing all the transmission\reception in the same function?

Thanks!

Nicolò

0 Kudos
1,274 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@NicoloStrozzi

Gald to help you.

      I think it is necessary to switch the GPIO directions,and seems that the device dose not support open drain on all pins(only pins are configured for a protocol like LPUART,LPI2C),and the GPIO pins support push-pull output mode.
      About the SCL_delay function you mentioned,it all decicded by yourself,but I think simpler is the better.

BR!

      Jim,

0 Kudos