CEC not working

I have an issue with CEC. The N2 is connected to a Marantz AVR, which is connected to a Philips TV. When booting the N2, there is a message that says it could not initialise the CEC adaptor. N2 does not react to any key press on the TV-remote. CE version is 9.2.

Kodi-Log: http://ix.io/1VzQ

There are some things that I’m wondering about:

1.)
When I connect the N2 (and only the N2) directly to the TV, CEC works flawlessly.

2.)
When in the situation (1) the AVR is connected to the TV, CEC still works. But as soon as the N2 is rebooted (with AVR and N2 connected to the TV) CEC doesn’s work at all.

3.)
With an Odroid C2 everything is fine in any configuration, regardlessly of being connected to TV or AVR or which version of Coreelec is used

So any idea where to look at?

seems like thats more and more a problem
many face the same. at least you can start the n2 with CEC when switching the inputs on your marantz.
when you have the n2 in the “game” hdmi port, then switch to “blu ray” and back to “game”.
i guess the n2 (coreelec) ignores some signals or has some kind of filter? or just a bug
unfortunately i have no idea of the CEC protocol itself
but it would also help to spread the word that there is a real problem

you can also reproduce that behaviour on your tv
plugin the n2 to hdmi1, change the default hdmi port in the tv to hdmi2, send the n2 to sleep.
when you turn on your tv, the n2 wont wake up as long as you dont change the hdmi port back to hdmi1

edit: sorry, just woke up. maybe its another problem, because i did not get an error message. and my problem was that the n2 did not even wake up.

I think the N2 CEC working as it should, i can wake the N2 with tv remote if the correct hdmi is selected. I don’t want to wake up N2 if some other hdmi is active

nice that it works for you, but for many others, it does not - including me.
It is not working as expected, because when i power on my tv, the avr turns on but the n2 not, regardless which hdmi input is selected. i have to manually switch to another one and back for the n2 to power up.
i never had such problems with raspberry (1 and 3), nor with the usb cec adapter.

CEC is not a strict standard, every implementation is different so you never know which device will work with an another device. You have a workaround to wake up your N2, then just use it.

There is a CEC specification, which for me sounds pretty strict: https://web.archive.org/web/20171009194844/http://www.microprocessor.org/HDMISpecification13a.pdf

my english is unfortunately not the best, but i could imagine that the problem is somewhere in Page CEC-22 of 97, CEC 13 -> CEC Features Description -> CEC 13.1 One Touch Play

I do. But a workaround is not a long-term solution.

Although CEC may be a strict standard, different manufacturers do not comply to it and there are different CEC implementations found in consumer products, that don’t stick to the strict standard.
I have 4 different products from 4 different manufacturers and each one has some different CEC inconsistency.

sounds reasonable, but when i use a raspberry with libreelec, everything works. when i use a odroid n2 with coreelec, it does not. i guess that hdmi cec stuff is implemented in software, not hardware, isnt it.

Yes it is, so compare CEC versions on these devices, are they the same ?

i gave the pi to my mom - that was the reason for me to buy the n2 (and of course the more performance :slight_smile: ). next time i will be at my moms place (in about 1-2 months) i will check that.
how can i check the version on coreelec?

I have 2 N2s connected directly to 2 different LG TVs.

At first, one of them didn’t Suspend correctly. Everytime I turn off my TV, it’s will also Shutdown the N2.
I noticed this because everytime I turn on my TV, it’ll turn on and shows the CoreELEC booting logo.
The other one doesn’t show any CoreELEC booting logo and went straight to Kodi Home.

After several on/off cycle, I selected “Suspend” manually from the Kodi Shutdown Menu.
Voilà! It no longer Shutdown the N2 and will Suspend correctly after that.
Somehow, that first manual Suspend, un-stuck it…

Both are now Suspend when I turn off the TV, and wakes up when I turn on the TV.
However…
Sometimes they recognized the CEC Remote Control immediately after wakes up, but most of the times they didn’t. I needed to change the Input channel on my TV, wait a couple seconds, and change back. CEC Remote Control works after i did that.

Then I played around in Kodi Settings/Input/Peripherals/ CEC settings.
Selected “None” on Devices to power on during startup
Selected “None” on Devices to power off during shutdown
Turn off Devices to also put in standby mode
Tried several other options, but turn them all back to default except those 3 options.

Somehow, they works…
Both of my N2s immediately recognize the CEC Remote Control after wakes up now.

Hopefully it stays that way… It seems they are rather temperamental… :wink:

But I can see, that Vendor which OP compare is the same: C2 and N2… Assuming he describes the same TV in both scenarios…

Regardless I was also unsucessfull to have 100% reliable CEC when AVR connected (no matter all adressing I tried), if CEC works for him with TVx + C2 +CE with libCECy, and doesnt with TVx + N2 + CE with libCECy, then I think something is really strange.

No one holds you back to improve the amlogic CEC implementation in 4.9 kernel. :slight_smile:

i would if i could, but i guess until i am in all that material and understood how to change and what to change, we have linux 8 and the devices are outdated :wink:
when i understood you correctly, this is some kernel code which is from amlogic. so the best candidate to contact (to get a bug ticket and/or help fixing that) would be amlogic?

My 2 cents. N2 HDMI to Media Player input on Denon X220W. Denon ARC out to Vizio P75 ARC input. Harmony Hub and remote programmed. When I hit TV button on harmony, TV only, N2 is off. When I hit Movie button on harmony remote, N2 wakes up. When I shut off, N2 says nitey-nite.
However I do have a problem (had with Libre board LePotato also. Screen goes black for 5-10 seconds whether watching something or just looking at Aeon Nox menu. Somehow I think it’s a handshake issue. Ordered new HDMI cable to check.

Logitech Harmony is an infrared remote and has nothing to do with CEC / HDMI, isn’t it?

Yes, if you have a Logitech Harmony IRC and you have programmed some activities then they need to turn off CEC.

I had a look to the Linux kernel CEC driver and found maybe a issue.
So here is a test build. It can be used for all Amlogic-ng devices, not only N2!
Maybe it resolve some CEC & Kodi issues!

  1. CoreELEC-Amlogic-ng.arm-9.2-devel-1569483170.tar

Changes:

"hardcode" default bootloader CEC setting to 0x3f
Do not touch received messages if address is not enabled.
  1. CoreELEC-Amlogic-ng.arm-9.2-devel-1569495571.tar

Changes:

"hardcode" default bootloader CEC setting to 0x3f
Do not touch received messages if address is not enabled.
Enable rx buffer on all CPUs

Please have a try first with nr 1, then nr 2 if still problem are existing!
This changes will have no affect to any wake-up issues!

EDIT:
About the Couldn't initialize the CEC adapter issue:
On kernel boot the CEC hardware driver aocec get loaded.
On Kodi start libCEC get loaded what is trying to open the driver aocec.
If it got opened it will send F0 by the CEC bus to ping if a TV is connected.
If now no reply is received the known Pule-Eight error pop up will be shown.
So the main reason of this can be, that the initialization is just too fast. Especially if a AVR is connected between the box & TV. When the AVR isn’t ready to forward the message between box & TV the system will not work.
So I guess this high amount of CEC issues seen by the users are related to this change:
Since G12(A/B) CECB is used. The big difference to the “old” CEC system in the SoC is the interrupt handling. So the handling between software & hardware got faster now and maybe Kodi and/or libCEC need to be adapt for this.

EDIT2:
I was digging really deap now in the Kodi & libCEC source about this issue and it is almost impossible to find a solution for me as the source is quit complicated.
The best way to solve your Couldn't initialize the CEC adapter issue:
Enable debug in Kodi and enable debug logging for the libCEC component.
Ask at http://libcec.pulse-eight.com/ for support.

Another “workaround” would be to delay the libCEC init on Kodi startup about ~5-10s until the hardware is ready for communication.

Thanks so much for your efforts on this. In my case (using S905x2 X96 max 4g/32g box), the “couldn’t initialize CEC adapter” message happened nearly 100% of the time. Then I upgraded the Android firmware from Oreo to Pie and also turned on, off and then on again the HDMI-CEC setting in Android first. Since then, I’m getting about 80-90% success rate with initializing CEC.

I’ll give your images a try and let you know. Thanks again!!

Also please enable debug logging in Kodi and add the libCEC component, please!