I2C clock signal

Not able to get the clock signal When i include toradex i2c librariry in stream driver and try to initiate i2c-0.
Sequence of calling API’s is as given below.


Setting ioScl and ioSda pins using I2c_SetConfigInt


Set slave address and trying to read data from the i2c-0 file descriptor using I2c_Read API

I2c_Read is not throwing any error, but will not read the data (0 bytes read).

Works fine when try to read using the I2c_Demo application provided by the toradex. Problem is only when i try to include the library in the our stream driver

Dear @Sarika,

Thank you for contacting support. Could you share your stream driver code, let us know look the code and try to reproduce the issue with your code. It would help us to find the solution quickly.
For sharing, you would use attachment feature here or https://share.toradex.com/.
Please post the link after uploading the file in share.toradex.com.



GPIO toggling also doesn’t when it is included in the stream driver source file

Dear @Sarika,

  • Why do want put GPIO and I2c library into stream driver?
  • Did you try to debug step by step through platform builder connected?
  • What was mode set for the driver in the .bib file? Try NK SH option
  • I guess you already verified driver loading during the booting process.
  • Toradex CE libraries leveraging the WinCE usage, it means you don’t need kernel mode driver to access GPIO and I2c from userspace. The performance will be same on the Toradex CE libraries as like kernel driver.
  • Please enable debug message and share the log message with us.
  • I2c_Open and I2c_Close should be called within closed to operations. Otherwise, other functions or threads can’t able to access I2c channel. I2c_Close never called after
    stat_ucKeyPadPowerOnVersion,8) == I2C_RW_FAILURE) on KPR_Init function.
  • NK SH is the mode set for the driver in the .bib file
  • yes we have already verified the loading of driver
  • Log file i2c_Log.txt

Dear @Sarika,

Thank you for your reply.

Could you share the complete driver project, that will help us to easily setup the driver project and look the issue? driver project directory, .bib and .reg configuration files.

Could you also reply for the remaining questions in my last reply? Did you correct the I2c_close function after the I2c_Read?

As per your log file output, it shows 112 devices found, this sounds something wrong. By the time, did you probe the clock to check the clock pin is driving?

  • I2c_close() function is called when device is uninitialized i.e, when XXX_Deinit() is called.
  • yes we probed the clock to check the clock pin and was always high.


Dear @Sarika,

Thank you for your patience and reporting this bug. The issue is kerenl mode API calling in the library that we fixed it and uploaded the complete driver project with library release here: KeypadRotary_Update.zip, please test that and let us know the feedback.
Also, calling I2c_open and I2c transaction during KPR_Init is not good design, it would be better if you call those functions in the KPR_Open function. Also, I2c_Open and I2c_Close should be very close to I2c transactions as like below

I2c_Write() or I2c_Read()

If port opened in the KPR_Init and calling Close in the Deinit is not good design, other threads or process can’t access the i2c port until port closed. Please refer KeypadRotary-Recommened.cpp file for our suggestion.

Please let us know if you have any other questions.

Dear @sarika,

There are few parameters that should be set before i2c_open and other parameters can be set after i2c_open, normally you don’t need to reconfigure the same parameters between close and open for a single slave communication. If the same port is used for multiple slaves or places, only the changed parameter must be reconfigured between open and start to transmission. Please refer Toradex_CE_Libraries.chm for more information.

Also, there are StoreVolatile and StoreToRegistry options available, please refer the same documentation for more information.

Why do i get this warning when try to access I2C

I2C Warning: .\src\i2c_vyb.c, 148: Start failed

Dear @Sarika

This is a new topic, not related to the title “I2C clock signal”. Please ask a new question, and add some more information what your code looks like (ideally add a code snippet or a whole project which allows us to reproduce the problem)

Regards, Andy

Thank you for the information. will test and send you our feedback.

One more thing is, do we need to configure I2c port each time after we call I2c_Open?