-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i2c read issues #4
Comments
Hi @deanm1278, I need to get myself one of those logic analysers, that is awesome. All I have are bulky old oscilloscopes! 😄 I think this is a bug with mbed caused by using not necessarily well-supported mbed APIs in our I2C abstraction (start and stop). Whilst you'd expect most abstractions handle both start and stops, I think the mbed abstraction does not expect it. Indicates that The best way to move forward is to subclass codal::mbed::Serial and override all The I2C abstraction works best when you have full control over the chip by writing to registers – we're on an abstraction skyscraper right now 😄 It should be noted that all of the above is speculation, but it is speculation informed by previous observations... As per usual, I'm tied up right now... I can see if I can free myself a little to patch this. |
@deanm1278 I'm in an airport right now, but I think I have pushed a fix. Would you be able to test? The two commits you'll need are: lancaster-university/codal-mbed@0677022 and lancaster-university/codal-circuit-playground@a4574d8 You will need to replace the I2C instance attached to the CircuitPlayground object with CPlayI2C from the commit above. Hopefully it works, let me know if you have any problems. 😄 |
Hey @jamesadevine unfortunately this doesn't seem to fix :(
behavior seems to be the same as before. @pelikhan @mmoskal please let me know if I was supposed to do something else to patch the codal core pxt is looking at. |
Hey @deanm1278, I believe the I2C package will need to have its class reference changed, it's probably still using codal::mbed::i2c? |
ok this seems to work better after the scope fix. I'm still getting crashes but they're different than before and I'll have to dig a bit deeper into what may be causing them. |
@jamesadevine I do have one more question though. Why is this just a circuit playground specific issue and not a general issue for all SAMD21 boards? |
@deanm1278 good question! I think my logic was that the circuit playground builds on mbed, and thus uses the Other devices that may come along may use the HAL rather than depend on mbed, and those implementations would be placed in this repository. |
ok also is this file still supposed to be using mbed::i2c? https://github.com/lancaster-university/codal-circuit-playground/blob/master/model/CircuitPlayground.h |
Moved to new CPlayI2C class as per lancaster-university/codal-samd21#4
@deanm1278 done. Although I don't think in MakeCode our singleton model is used, @mmoskal ? |
@jamesadevine thanks! Right I don't think it does use the singleton model. Where I'm a bit stuck now is how to update this file to override the default I2C object for just the CPlay without also changing it for all other SAMD21 boards: https://github.com/Microsoft/pxt-common-packages/blob/master/libs/core/platform.h |
As discussed on Discord: All SAMD21 boards in MakeCode use the codal-circuit-playground codal target, so we should be good to change |
Hello! I am having some i2c read problems and I think this is the correct place for the report. I2C Seems to read an extra byte that then gets discarded. This could cause problems with certain I2C devices. Calling from makecode (with extra code stripped out since this gets called in a library):
reads an extra 0xFF byte at the end:
I am also having an issue where I2C reads will just stop seemingly at random and return a strange value. Running the same code as the above screenshot stops after a while:
You can see one byte was read, an ACK was received, but the i2c master stops reading and never sends another read...
The
You can see this happening if you run this example on makecode.adafruit.com with the crickit package with circuitplayground express and adafruit crickit hardware.
The text was updated successfully, but these errors were encountered: