-
• #2
wow - thanks a lot !
-
• #3
@Frida now I found some time to test this nice modifications
step one build a version with your modification and run some simple tests
I2C1.setup({sda:D4, scl:D5, bitrate:100000}); =undefined >I2C1._options ={ "sda": D4, "scl": D5, "bitrate": 100000 } >
read data from eeprom
>I2C1.readFrom(0x62,9); =new Uint8Array([48, 50, 48, 49, 48, 48, 48, 50, 50]) >I2C1.readFrom(0x62,9); =new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 255])
hmm ?
>I2C1.readFrom(0x62,9); =new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 255]) >I2C1.writeTo(0x62,1); =undefined >I2C1.readFrom(0x62,9); =new Uint8Array([48, 50, 48, 49, 48, 48, 48, 50, 50]) >
can not read twice, have to send dumy writeTo to read again ?!
i2cget -y 2 0x62 0 has no problems ......
any comments or hints ?
-
• #4
Not at the moment. What type of eeprom are you using?
-
• #7
According to the datasheet:
The PCA9501 contains an internal address counter that increments after each read or
write access and as a result, if the last word accessed was at address ‘n’ then the address
counter contains the address ‘n + 1’.So if you make two readings after each other, the address counter are moving further.
So you have to reset the adress counter to the beginning of your data, to get the same out again.
-
• #8
Yep - rtfm - thanks !
-
• #9
Hi all,
I am having the same issue with the I2C as described on the first post. I am currently using firmware 1v85 and 1v86 (from @tve github) and found that the fixes on both the ".h" and ".c" files seemed not implemented.
I would appreciated just direction on what to do to get me going, as I would like to implement I2C to the Wemos R1 D2 board.
-
• #10
If there isn't somebody that have made a pull request, it isn't in the original version.
I don't have the knowledge, to do a pull request. -
• #11
ups - missed that, will create a pull by tomorrow
-
• #13
-
• #15
@Frida please double check i2c_master.c and jshardware.h
@tve please also take a detailed look, if possible.
-
• #16
jshardware.h seems to be ok.
You've moved some things around for jshardware_common.c.
My concern is if the order of/// Settings passed to jshI2CSetup to set I2C up typedef struct { int bitrate; Pin pinSCL; Pin pinSDA; // int bitrate; // timeout? } PACKED_FLAGS JshI2CInfo;
will influence on the other micro's, that have I not tryed.
I will check the other later on.
-
• #18
Yes I have changed it, but I never tested it on Espruino or Pico, to see if there were any problems there.
-
• #19
Ok - no problem - I can check on Pico
-
• #20
Well, I downloaded Gordon's latest sources.
I made some changes, and from your files.
Special from i2c_master.c I have comentet some more lines out.
I compiled it, downloaded it to ESP8266-01, and it ran.//i2c_master_wait(1); // sda 0, scl 1 //*********************
These lines are not needed anymore.
Try it out.
2 Attachments
-
• #21
Looks like the way the checking for clock stretching is coded it'll make everything quite a bit slower. At what clock rate does it operate with the clock stretching code?
-
• #22
As I said in post #1:
Are there somebody, that have some equipment to test the bitrate, and to try it out?
Because, I don't have.
I have it running with htu21d and wi-nunchuck or 2 htu21d with sda and scl crossed
while they only have 1 address. -
• #23
at the moment I am testing my i2c devices with 100KHz
-
• #25
I'm interested in the I2c master software - can you confirm which is the latest file, is it compatible with ESPRESSIF's I2c master - and if so am I right in saying that clock stretching is implemented but there is no timeout - ie if the slave pulls the clock low and keeps it there the ESP will eventually watchdog reboot (if that is the case I'll endeavour to add a timeout)..
Any help appreciated - I'm doing great with the Espressif code but the lack of clock stretching is an issue for me. Just programming in C.
After more than 10 days; I have solved the crash problem. It was in jshardware.h.
When the program was to store the bitrate in the address, the address was not divisible by 4.
I hope it will run on a normal Espruino too. I haven't tested it yet.
I have also chaged a lot in i2c_master.c
When x is under 4 then the result was 0. So the waiting in the program was not good.
Now I use this
and sat it up so it could wait between 1 and 4 us.
I don't know the bitrate, but I have it running with wii nunchuck and htu21d at the same time.
Se the attachment files.
Are there sombody, that have some equepment to test the bitrate, and to try it out?
And clockstreching on all places where the clocksignal goes from 0 to 1.
before any change:
after change in:
Espruino/Espruino/src/jshardware.h
after change in:
Espruino/Espruino/targets/esp8266/i2c_master.c
2 Attachments