I2C.scan() not returning slave addresses

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

I2C.scan() not returning slave addresses

Post by Yadnik » Fri Jul 23, 2021 5:29 pm

On doing i2cscan() my board running on zephyr port of Micropython does not return address of slave.I have enabled I2C and SPI in the _defconfig file.Do I have to make changes in the .dts file? Can someone please help.
The link to my boards dts file is :https://github.com/jadonk/beagle_connec ... reedom.dts
I have also enabled hardware drivers on my board like this https://github.com/micropython/micropyt ... _k64f.conf and flashed application firmware again on my board.
Can someone please help.Thank you very much!!

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: I2C.scan() not returning slave addresses

Post by Yadnik » Sat Jul 24, 2021 3:57 pm

Also had a very basic doubt around this, if i2c.scan() just returns [] in my case(even after connecting sensor), does it mean I can't get sensor data using the i2c bus?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C.scan() not returning slave addresses

Post by Roberthh » Sat Jul 24, 2021 5:01 pm

If it just return the empty list, then there is no connection to the I2C device, and you will not be able to use it. Check the cables, pull_up resistors, etc,

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: I2C.scan() not returning slave addresses

Post by Yadnik » Sat Jul 24, 2021 7:17 pm

Thanks for reply Robert,
However I am using click boards, and my microcontroller board has a MickroBus connector on it.You can see the photo here:https://github.com/Yadnik1/zephyr/blob/ ... eedom.jpeg
I also tried connecting the click board to TI cc1352r launchxl and checked the connections thoroughly but I am faced a same issue.I strongly believe it is could be a software issue.
It would be very helpful if you could please guide me with this.
Thank you very much!!

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: I2C.scan() not returning slave addresses

Post by Yadnik » Sat Jul 24, 2021 7:19 pm

I have been using the zephyr port of Micropython and have tried making changes to the defconfig file by enabling the hardware drivers (eg CONFIG_I2C=y) and also enabled hardware features in the boards folder to MicroPython application firmware like this: https://github.com/micropython/micropyt ... edom board.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C.scan() not returning slave addresses

Post by Roberthh » Sat Jul 24, 2021 7:54 pm

I cannot help you with these boards or Zephyr. The only thing obvious from the error messages is, that the I2C device is not connected, whether the culprit is hardware or software.

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: I2C.scan() not returning slave addresses

Post by Yadnik » Sat Jul 24, 2021 8:20 pm

Thank you very much for your help Robert,
I'll ask the Zephyr folks and share my findings here for future references.

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: I2C.scan() not returning slave addresses

Post by shaoziyang » Sun Jul 25, 2021 9:52 am

In micropython I2C default clock speed is 400K (fast mode), so if your I2C device only support 100k speed (normal mode), it will not return.

You may change I2C speed and try again.

Post Reply