-
Notifications
You must be signed in to change notification settings - Fork 2k
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
boards: ikea-tradfri: add support #8047
Conversation
This will void the warranty of your IKEA product. |
Is there a radio on-board (and do we support it already)? |
It has a radio on-board, but we don't support it yet. But now I have more motivation to do so :-) It would be a nice product/board for demo purposes. |
Yes definitely! I've been waiting for hacks like this basically since day one of my contribution (but never found the time to do it myself 😞). |
Eeeexcelleeeent!!! I was thinking about these products since I was aware of them, but I'm glad you also investigated them! I'll try to grab some and hack them with RIOT. |
I guess I have to guess I have to go to IKEA again (damn it I was saving up for a new PC!!1! 😜) |
Awesome!!! My wife will be sooo happy that I am now motivated to go to ikea (besides the usual hot-dog motivation) :-) Will review do a review right away. |
* @{ | ||
*/ | ||
#define LED0_PIN GPIO_PIN(PA, 1) | ||
#define LED1_PIN GPIO_PIN(PB, 13) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From your video I take that this pin is connected to the FET switching the actual light, right? So what is LED0 connected to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to think about this, and see what is useful. In my case, PA1 was also soldered, but I don't know what it does (haven't traced it properly).
Since the same board is used in different light bulbs or accessories, I had this idea of defining different pins on an additional compiler flag. E.g. IKEA_PRODUCT=ligthbulb
or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So I guess lets leave it for now and see what further reverse engineering brings...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After closer inspection, it seems that PA1 is only connected for fixing the PCB. It leads to a dead end (missing resistor).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's connected in the more expensive versions? The versions that can change the white color between warm and cold (not only brightness) have 2 different LED-types for this - cold whites and warm whites. So there's probably one color on each connector?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is definitely possible. In other teardowns you can see that more pins are connected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny remark, else looking great!
.dev = USART1, | ||
.mosi_pin = GPIO_PIN(PD, 15), | ||
.miso_pin = GPIO_PIN(PD, 14), | ||
.clk_pin = GPIO_PIN(PD, 13), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything connected to these pins (or rather: are they accessible)? If not, we might just want to skip the SPI configuration all together for this board?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an additional SPI flash that we might want to access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so never mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but based on reading the JEDEC ID and Product Identification, it seems that a 2Mbit flash by Integrated Silicon Solution Inc. (part number IS25LQ020B) is used.
Hey thats cool! Based on your work I started with the radio driver and support for the Silicon Labs Dev-boards. It is still work in progress and based on the RIOT version from February, but could be a starting point to get RIOT on light bulbs :) |
@kaibeckmann That's cool! I can help you if you want! I am also working on another PR which will improve support for EFM32, based on feedback by @haukepetersen. Hope to create a PR this weekend. In the mean time, I have updated https://github.com/basilfx/TRADFRI-Hacking and added some work-in-progress schematics and PCB designs for development. I first need another trip to IKEA! |
@basilfx Yeah that could speed things up! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concerns are addressed -> ACK ACK ACK
@kaspar030 I know you won't like the duplicated code in this PR either, but I'd say we merge this anyway and wait for the results of #8058 and clean-up/unify around the EFM32-based boards once a structure is decided. |
@basilfx is there a way to backup the existing firmware? (in case of we want to come back to the default behaviour). |
@kYc0o Yes, I've managed to backup a copy of the firmware. I haven't tried to flash it back, but I will try that tonight (just went to IKEA to buy some more lights). |
There is this effort too. |
Nobody dares to merge this awesome feature? |
I have a small fix for the SPI pins. I have confirmed that it works, because I can read the SPI chip. |
ec2bba9
to
d710676
Compare
It was maybe acked too fast 😉 |
Now also featured on Hackaday: https://hackaday.com/2017/11/17/hacking-the-ikea-tradfri-light-bulb/ |
Waaaaao!!! Congrats! 😃 |
Whoopwhoop \o/ |
Can you point me to the comment where this is stated? I couldn't find it. (and why wasn't the review dismissed then 😉?) |
If somebody wants to re-ACK my last commit (d710676), than I will squash, rebase and commit when Murdock agrees! |
I didn't mean too fast in the sense of "bad-acked" but in the sense that several changes came just after it was acked which can also belong to this PR. We could have merged this as it was acked (since it was OK to ack it, everything worked as expected and the comments were addressed), and the modifications and improvements which came afterwards would have been part of another PR. Thus, nothing to dismiss, nothing to complain, just a personal impression. Waiting a bit more before merge it gave us other features and better understanding. |
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x00000000, LENGTH = 262144 | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 31744 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened with the remaining 1K of RAM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly, 1 KiB is reserved for the (proprietary) radio (driver). However, I've double-checked with the Gecko SDK, but that number is correct :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I suppose that is managed internally since I don't see any specific instruction in the ld you cite on which they make use of the last 1K of RAM. Though it looks a bit strange but if it works let's continue this way.
|
||
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x00000000, LENGTH = 262144 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
262144 can be written as 256K to make it a little bit more friendly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change that, but I have another PR coming up that will use the default Cortex-M linker scripts :-)
re-ACK your SPI fix -> please squash and I will be happy to press the big green button :-) |
d710676
to
c51948c
Compare
@haukepetersen Go ahead :-) |
My pleasure! -> go |
🎉 |
Last week I found out that the IKEA TRÅDFRI lighting products and accessories use the Silicon Labs EZR32MG1P microcontroller. Let it be a coincidence that the Thunderboard Sense (#7929) which was merged this week, uses the same CPU!
Now if we look into their line of products, it happens that they use the same CPU module in all(?) of their products: here, here and here. Nonetheless, you can isolate them from the product, and use them for your own ideas, or leave them in and flash a custom firmware.
The MCU is a ARM Cortex M4 with 256 kB of flash. It's quite packed (including hardware crypto), flexible pin mapping and has an integrated radio which supports Thread, ZigBee Light Link and more.
It won't surprise me if people buy the cheapest light available (the GU-10 I used costed me 6,99 euro) and upgrade, hack or repurpose them. Let RIOT-OS be one of the first to support them :-)
This PR is a quick port to this new platform. I have more information on the module over here and a demonstration video here. For flashing you need to connect a JTAG/SWD compatible debugger, but I can flash it the exact same way as the Thunderboard Sense when I use SEGGER JLink. You do not even have to remove the module.