WCL Posted January 11, 2019 Share Posted January 11, 2019 Hi all, I'm trying to use Protocol(I2C Master) to communicate with my slave device. Here is the I2C Protocol signal: and here is signal from logic analyzer: 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: 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? Link to comment Share on other sites More sharing options...
attila Posted January 11, 2019 Share Posted January 11, 2019 Hi @WCL For I2C you should use OD signals with pullup, like this: Link to comment Share on other sites More sharing options...
WCL Posted January 12, 2019 Author Share Posted January 12, 2019 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 Link to comment Share on other sites More sharing options...
WCL Posted January 14, 2019 Author Share Posted January 14, 2019 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 Link to comment Share on other sites More sharing options...
attila Posted January 14, 2019 Share Posted January 14, 2019 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. Link to comment Share on other sites More sharing options...
WCL Posted January 15, 2019 Author Share Posted January 15, 2019 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. Link to comment Share on other sites More sharing options...
Question
WCL
Hi all,
I'm trying to use Protocol(I2C Master) to communicate with my slave device.
Here is the I2C Protocol signal:
and here is signal from logic analyzer:
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:
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?
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.