Community news, upcoming events and general discussions
Threads: 36 Posts: 88
Get technical support from the community
Threads: 1427 Posts: 7608
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 36 Posts: 119
Share and discuss community member projects
Threads: 81 Posts: 350
I would like to know whether there are any Projects or Demos, in which the XDK could be used as a slave which gives out sensor values after being asked for these values by a master over I2C.
Dear Greetings, Benedikt
Welcome to the XDK community.
Unfortunately there are not demos that cover your specific use case.
But in general the EFM32GG390 microcontroller of the XDK supports both, master and slave I2C functionality. I am not quite sure, if it is possible on the highest API level. On the first glance I do not think so, but I am certain it can be implemented on lower API levels like em_i2c.c.
Please tell me if this is helpful and do not hesitate to ask if you have further questions.
Kind regards, Franjo
Thanks a lot for your very quick answer!
I am not yet sure whether I will make the XDK talk over I2C or some other way, but in case of I2C, I will come back to your kind offer. Your information about em_i2c.c was a good to know, I'll have a close look to that.
Yours sincerely, Benedikt
Hello Benedikt, I am glad to hear that my suggestion is helpful. Please let me know if you have further questions. Kind regards, Franjo
Hi Franjo, hi all viewers,
Unfortunately, that way did not work as planned, but I saw that there might be another option: There are two I2C-Bus-Pin at the Port of the XDK (Source below): The ports B9 and B10 are accessible over the extension board and they are part of the bus I2C1.
That's why I would like to know: Is it possible to connect the two I2C-Bus-Systems I2C0 and I2C1 to connect the internal Senors from I2C0 to the external pins? Maybe there is a software-controlled switch for that?
https://xdk.bosch-connectivity.com/xdk-api -> Related Pages ->XDK Extension Bus User Guide
I am sorry to hear that it didn't worked out as you expected. First I would like to clarify some issues about your new I2C attempt.
Am I correct, that you try to implement a direct access of your external device to the internal I2C0 channel to access the internal XDK sensor data directly?
If this is true: Unfortunately, there is no internal switch that the I2C0 channel can be accessed of the extension bus pins of the I2C1 channel. All pins of the extension bus are directly connected to corresponding pins on the XDK MCU. Therefore if you want to receive sensor data over I2C, you have to implement an application which passes the sensor values from the MCU to you external device.
May I ask, what the basic idea of your purpose is? Maybe I can make some useful suggestions.
Yes, you are correct, I would like to access the sensor data as directly as possible. A behaviour such as if they were not packaged in XDK but sold solely and placed on a breadboard with a wiring for I2C would be ideal. This way I could poll the sensor data from the external device by simply adressing the registers of each sensor.
Well, you said the I2C-Busses can not be connected to each other, because there is no such switch. Alright then I will have to look for an other way:
You proposed i could"implement an application which passes the sensor values from the MCU to [...] external device". Some suggestions for that way are always welcome! In this case I would have to make the XDK poll the sensor data, store them, wait for incoming requests to read the values, and answer these requests depending on address an register in the request. Is that similar as you proposed?
I had exactly that in mind. Unfortunately there is currently no detailed I2C documentation available about how to implement the proposed functionality on the XDK. In addition there is currently no example in the extension bus guide you linked available.
I asked some developers if anyone has an I2C example to speed your implementation up.
Meanwhile, is it urgently necessary to implement the communication on I2C or could it be another serial (for example SPI) to receive the data.
I am asking because there are pretty good examples available for SPI and UART.
Yes you are right: in my linked extension bus guide there is no example, only some external I2C-pins listed in the chapter "Extension header pin assignment":
These Pins made me hope that there would have been a possible solution like connecting these pins to internal bus I2C0. That's why I linked it.
Well, I already implemented a communication between the XDK and the external device over USB, which works fine. There are indeed some pretty good examples for that. On the other hand, my boss would prefer a communication via I2C rather than USB, so I'll have a talk with him the next days and come back to you.
XDK as I2C-Slave
it is great to hear that you already implemented a solution via USB.
A solution via I2C is also possible, of course. I will get back to you immediately when I receive the information I asked for. Please keep me also posted on your progress.
thanks a lot for your kind offer.
Today I talked to my boss- we still prefer the way over I2C, so USB is just if I2C doesn't work. So I indeed hope for your source of information.
Unfortunately, I still haven't received any information about my I2C request. Thus I can only ask you for patience.
I will keep you in the loop and post any news I receive here.
I have received new information about I2C. Unfortunately there is no example implementation available to show how to use the external pins of the extension bus to communicate via the I2C bus.
Fortunately I found an example I2C implementation of the underlying interface em_i2c.h in the community forum of silicon labs.
It explains in detail how to implement an I2C communication with the XDK’s internally used I2C channel I2C0. Maybe you can use that as starting point to implement the communication for the external I2C channel I2C1.