7 years, 6 months ago.

I2C_SDA0 and I2C_SCL0

Normally i program PLC's and programming C has my attention for quite some years now, but somehow i always get lost in the maze of header files and definitions. That's why i still have not made any progress in embedded stuff, but still it stays itching to get more.

Now i my search i try to find the definition of I2C_SDA0 and I2C_SCL0 for my microbit board, but shoot me.. I cannot find them. Somehow this should be hard to answer for you die hards, but somehow i need it for understanding. Could someone point them for me in the microbit git tree ? searching on github went into a black hole for me.

Maybe it's better to have someone to guide me personnaly for some initial questions and so on. So if someone in the nothern part of holland is willingly to assist me, please let me know.

Always gratefully D.

1 Answer

7 years, 6 months ago.

https://lancaster-university.github.io/microbit-docs/ubit/i2c/

/media/uploads/juthi/microbit_i2c.png

Since the microbit board contains a few I2C devices already, this means the required pull-up resistors for proper operation on the I2C SDA & SCL lines are already present. So you can simply mate your external I2C widget to the SDA, SCL and common ground pins to get started.

Pass the proper address to chat with your I2C widget and you should be good to go.

Source code for the I2C device driver used by this board is posted here:

https://github.com/lancaster-university/microbit-dal/blob/master/source/drivers/MicroBitI2C.cpp

You only need to call the high level routine to access this code chunk:

/media/uploads/juthi/microbit_i2c_example.png

http://microbit-micropython.readthedocs.io/en/latest/i2c.html

http://www.iot-programmer.com/index.php/books/27-micro-bit-iot-in-c/chapters-micro-bit-iot-in-c/49-micro-bit-iot-in-c-i2c-bus

Thank you sanjiv. Somehow i was midlead by the pins ( 19,20 ) on the board and the real pins on the CPU ( 0, 30) . Just now i found them in pinnames.h .

Up to the next problem.. the #define statements.. which one are set for this type of CPU ?

posted by G Eastwood 23 May 2017

--

This board is supported by mbed so treat like any other mbed circuit board. You will need to follow the getting started tutorials and configure your online cloud account to import this board:

https://developer.mbed.org/platforms/Microbit/

Scroll down and select the "Add this board to your mbed compiler" and then mbed will do the rest after you login. After this step, you are free to test examples like LED Blinky, etc.

The low level details are handled by the device drivers created by the support group for this board.

Summary: Log in to your mbed account. Add this target board to your account. Import the LED Blinky to get a feel of how to use and expand from there. There are bound to be many I2C related examples as well which you can import.

Watch this video:

https://developer.mbed.org/platforms/Microbit/#getting-started-video

posted by Sanjiv Bhatia 23 May 2017