Page 1 of 1

[PCA10028/NRF51] - does the I2C work in 1.11?

Posted: Tue Dec 03, 2019 4:27 pm
by bgolab
Hi,
Has anyone tested the I2C on nrf51 running MicroPython 1.11?
Tested both:
i2c=I2C(-1, scl=Pin(1), sda=Pin(0))
i2c.scan()
[]
and
i2c=I2C(0, scl=Pin(1), sda=Pin(0))
i2c.scan()
[9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119]

The I2C is working on STM32 board.
The pull up resistors are fine.

Bogdan

Re: [PCA10028/NRF51] - does the I2C work in 1.11?

Posted: Tue Dec 03, 2019 7:30 pm
by bgolab
Just flashed pyboard with 1.11 and I2C works with the same I2C module:
>>> from machine import I2C, Pin
>>> i2c=I2C(1)
>>> i2c.scan()
[60, 76]

Re: [PCA10028/NRF51] - does the I2C work in 1.11?

Posted: Tue Dec 03, 2019 8:50 pm
by bgolab
Problem solved!
- I looks like the scan shows too many addresses - whereas the pyboards does it right - see the previous post.
- only option '0' works fine; the '-1' shows nothing if it comes to scanning

>>> MicroPython v1.11-611-g7f24c2977-dirty on 2019-12-02; PCA10028 with NRF51822
Type "help()" for more information.
>>> from machine import I2C, Pin
>>> i2c=I2C(0, scl=4, sda=3)
>>> i2c.scan()
[9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118]
>>> import ssd1306
>>> oled=ssd1306.SSD1306_I2C(128,32,i2c,60)
>>> oled.text('ala', 1, 1, 1)
>>> oled.show()
>>>

Re: [PCA10028/NRF51] - does the I2C work in 1.11?

Posted: Wed Dec 04, 2019 9:40 am
by pythoncoder
If software I2C (-1 arg) isn't working on that port perhaps you should raise an issue. I'm puzzled by the number of addresses returned by your scan. Why so many when the Pyboard returns only two?

Re: [PCA10028/NRF51] - does the I2C work in 1.11?

Posted: Wed Dec 04, 2019 9:46 am
by bgolab
Yes, it's weird.

I am mostly C developer for STM32 boards. And always implement a scan capability - these modules (OLED, FRAM) worked wine with my software.

Started playing with MicroPython on nrf51 and came across this strange issue (the scan behavior).
Then switched for a test to pyboard as this board seems to be matured.

It looks like both modules have proper pull ups (I looked at PCB without measuring the resistance + my C programs wok reliably + MicroPython and OLED module work fine).

It looks like a timing issue only for the I2C scan.

I cave a logic analyser (Saleae) to theoretically I could look at the I2C timing & response but in this week.