• 0
Sign in to follow this  
WCL

Some problems in using Protocol and Pattern tool

Question

Hi all,

I'm trying to use Protocol(I2C Master) to communicate with my slave device.
Here is the I2C Protocol signal:
1450787341-3597609114_n.png.526d0f586b9f107c73c4d129991ff74b.png

and here is signal from logic analyzer:
1903096277_I2CMaster.thumb.PNG.5c78301c144844266834831e15f9e701.PNG

Q1. The protocol works fine when I transmit slave address, but why the STOP pulse is occur after the last clock?

 

Then, I try to generate a I2C Master signal by Pattern tool.
Here is my signal:
Pattern2.thumb.PNG.c45c9fd24ab3525a9387c395b374932a.PNG

I think this signal is more like the first picture? but my slave device doesn't work fine...

Q2. Does anyone try to generate I2C master signal by using script or Pattern?

 

 

Edited by WCL

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi, @attila

Thank you for your reply. but do you know why the Q1 and how the Q2?

If I generate signal by using script to control Pattern tool, like this:
 

var rg1 = [0,1,0,0,1,0,0,0,0]
Patterns1.Channels.DIO0.custom = rg1

but I need to wait ACK from my slave device. Do you know how to do?

 

Thanks

Edited by WCL

Share this post


Link to post
Share on other sites
  • 0

Hi @attila,

I'm trying "wait(second)" function in my script. After testing, the smallest delay time is about 10ms?

I programmed script like this:

for(var i = 0; wait(0.01) && i < 1000; i++){
	StaticIO.Channel0.DIO0.value = 0;
	wait(0.01)
  	StaticIO.Channel0.DIO0.value = 1;
}

and it should be 50Hz, but the scope shows 25Hz, Is it because of delays?

Thanks

Edited by WCL

Share this post


Link to post
Share on other sites
  • 0

Hi @WCL

From an application you can't have precise timing. Under an OS (except with rtos) you can't have timing certainty...
Use the  Patterns to generate 50Hz clock.

Share this post


Link to post
Share on other sites
  • 0
14 hours ago, attila said:

Hi @WCL

From an application you can't have precise timing. Under an OS (except with rtos) you can't have timing certainty...
Use the  Patterns to generate 50Hz clock.

thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this