archi / melbus

Implementation of a node for MELBUS, as used in older Volvo cars.
GNU General Public License v3.0
15 stars 4 forks source link

Missing g_dev in stable branch #2

Open Shtutnik opened 8 years ago

Shtutnik commented 8 years ago

Hey,

Just wondering if this is on purpose or not. The stable branch seems to be missing "g_dev = &(g_devices[i]);" line in protocol.h Is this on purpose? There seems to be other stuff missing the the stable branch. Should I just use the master branch instead?

Thanks! Really appreciate this project! :clap:

archi commented 8 years ago

Hi Shtutnik, I already replied via E-Mail, but I'll be answering here, too ;)

So yes, you are right, I removed some debugging code and seems like I discarded that line by accident. I added it back in master, but I should probably port that change to stable.

You can either add that line locally, or just try using the master branch. While it should not wreck your hardware, it is not guaranteed to emulate MD/CD or even build. But I believe the state here on github should be fine (haven't worked on it/pushed in a while).

Sadly, I am a bit stuck (even though I got an extra head unit to tinker with on my desk), and I can't figure out why the HU seems to hate me - having no documentation makes this really difficult. But thanks for your appreciation, that really means something to me :)

Shtutnik commented 8 years ago

Hi, Thank you for responding so quickly! I tried the master branch code and it is much much better than the stable branch. Good job! Sadly, for me this also doesn't work. It seems that the readings I get are inconsistent. Do you have a similar problem? Could you kindly elaborate a bit about your wiring diagram? I mean, do you connect the BUSY,CLOCK,DATA pins directly to the arduino or is there some kind of electronics to handle noises and such (capacitors etc..)? I keep on getting extra logical 1 bits in the readings which make it impossible to get it to work. For example instead of 0x07, 0x1a, 0xee I am getting either 0x07, 0x2b, 0xef or 0x07, 0x2b, 0xee or 0x07, 0x1b, 0xef and such.. I am very eager to make this work, so if you want to share ideas I will be more than happy to do so!

archi commented 8 years ago

I am not an electrical engineer, only a software guy. So I just wired it up directly. Maybe due to my extra step-down converter I have less noise, or my board might be just less noisy. Or I am simply lucky, but it works that way (but might be the reason why I am unable to send? Will check).

But IIRC putting a 100 Ohm resistor on the three Melbus lines should improve the signal (in line, Arduino PIN -> resistor -> HU). Others are doing this, so you should try it, too.

Also, due to your post I took a look at http://gizmosnack.blogspot.de/2015/11/aux-in-volvo-hu-xxxx-radio.html again, and there is some fresh code which seems to send. Soooo, maybe I will be able to improve after all, using that code as a Melbus-Reference :)

Shtutnik commented 8 years ago

I see.. well actually that is a bit weird.. Because I am able to send data and the HU seems to respond to it (I think) because I am able to receive the next messages. So the HU must be receiving my messages, but the problem is that I get different data readings so the arduino misses messages and doesn't respond well. I never managed to get further from there so I don't know if that is the problem or not.. I just get a CD E message on the HU :(

Anyway, I will do what you suggested with the resistors. Actually I am powering the arduino from the USB port of my laptop and not from the HU because the HU gives me 9V and I didn't think that it matters. But I will try using a step down converter and use the USB only for serial debugging and see if that helps.

I really think that your code is correct and does manage to send commands back since I saw a lot of code which tries to "talk" MELBUS and I think you have it right. But we will have to keep on trying our luck I guess.. I'll write back once I do more testing