BMW E46 Fanatics Forum banner

241 - 260 of 2022 Posts

·
Registered
Joined
·
10 Posts
You shouldn't have CDC with the pibus unplugged. Did you leave the changer plugged in with the pibus?
It is not showing "CDC", it is showing "CD" when the pibus is not connected. I assume this is the slot loading CD in the head unit.

With CD changer connected, Mode cycles through Radio, "No Discs" (changer) and "No CD" (head unit CD).

Without CD changer connected, Mode cycles through Radio, and "No CD" (head unit CD).

With pibus connected Mode cycles through Radio, "TR04 CD1" (pibus spoof of changer?) and "No CD" (head unit CD).
 

·
Registered
Joined
·
10 Posts
Yes, mine has changer in the boot (model 6512 6977766-03) and a slot load CD under a flip down screen on the head unit.

The head unit looks different to the one in an earlier post by Peter too.
Mine looks more like this one:
http://forum.e46fanatics.com/showthread.php?p=15905785

Assuming it is the text string that is the problem, is it the microcontroller that handles it or the SW running on the Pi? If it is the Pi, then hopefully it's just a simple code change and remake. If it's running on the micro then I don't think I have the technology to build and reprogram :hmm:
 

·
Registered
Joined
·
43 Posts
I am not sure if it is in the RPi-software or the microcontroller, but looking at "ibus.c" in the pibus/rpi directory, it could be in the Linux software.
Line 335 says: "{20,"\x68\x12\x3b\x23\x62\x10\x43\x44\x43\x20\x31\x2d\x30\x34\x20\x20\x20\x20\x20\x4c", "CDC 1-04", NULL, 0, cdchanger_handle_cdcmode}".

But I would wait for PeteAU to confirm that.
As he wrote in an earlier post: there are 5$ Microcontroller programmers from Hong Kong on eBay, so even if it was a microcontroller thing you could change it, I guess.
 

·
Registered
Joined
·
10 Posts
Thanks Mopinski. Found that too. Note there is also a defined message containing TR 04" directly after the "CDC 1-04" message. I'm still trying to get my head around their usage. Hopefully Pete can chime in since he knows the code best.
Just downloaded the ibus.txt log and are going to try searching for equivalent messages.
 

·
Registered
Joined
·
541 Posts
Discussion Starter #246
I am not sure if it is in the RPi-software or the microcontroller, but looking at "ibus.c" in the pibus/rpi directory, it could be in the Linux software.
Line 335 says: "{20,"\x68\x12\x3b\x23\x62\x10\x43\x44\x43\x20\x31\x2d\x30\x34\x20\x20\x20\x20\x20\x4c", "CDC 1-04", NULL, 0, cdchanger_handle_cdcmode}".

But I would wait for PeteAU to confirm that.
As he wrote in an earlier post: there are 5$ Microcontroller programmers from Hong Kong on eBay, so even if it was a microcontroller thing you could change it, I guess.
There is code in both the Pi & ATtiny that looks for the CD-changer strings:
- The Pi uses this to switch "keyboard focus".
- The ATtiny uses this to switch the video signal.

It's possible onefifty370 has a different model radio we haven't seen yet, that has a slightly different string. If that turns out to be the case, it's not a total disaster, you can get a $3 programmer off ebay and change the code - I'll show you how if need be.

At the moment it looks for two possible strings:

1. \x68\x12\x3b\x23\x62\x10\x43\x44\x43\x20\x31\x2d\x30\x34\x20\x20\x20\x20\x20\x4c - "CDC 1-04"
2. \x68\x0e\x3b\x23\x62\x10\x54\x52\x20\x30\x34\x20 - "TR 04"

The second one was added by an M3 owner in Europe, my car doesn't use that one, and it seems to be a rare variant.

onefifty370: EMail me your ibus.txt log file and we can see if your car behaves differently or not.
 

·
Registered
Joined
·
112 Posts
It is not showing "CDC", it is showing "CD" when the pibus is not connected. I assume this is the slot loading CD in the head unit.

With CD changer connected, Mode cycles through Radio, "No Discs" (changer) and "No CD" (head unit CD).

Without CD changer connected, Mode cycles through Radio, and "No CD" (head unit CD).

With pibus connected Mode cycles through Radio, "TR04 CD1" (pibus spoof of changer?) and "No CD" (head unit CD).
Sounds like you have a 2005 onwards radio module mate (with the latest firmware), these replace the cd message with TR, maybe the PiBus is now not "seeing" the correct cd string and therefore not switching.

Looking at the PiBus code (I've commented the hex code on the left)

buf[0] == 0x68 && /* Radio Source */
buf[6] == 0x43 && /* C */
buf[13] == 0x34 && /* 4 */
buf[19] == 0x4c) || /* L */
(bufPos == 16 &&
buf[0] == 0x68 && /* Radio Source */
buf[6] == 0x54 && /* T */
buf[7] == 0x52 && /* R
buf[8] == 0x20 && /* "space" */
buf[9] == 0x30 && /* 0 */
buf[10] == 0x34)) /* 4 */

The short string seems to be correct, but the long string seems to be looking at the wrong code, I think it should be looking at (43 44 43 20 31 2d 30 34)

buf[0] == 0x68 && /* Radio Source */
buf[6] == 0x43 && /* C */
buf[7] == 0x44 && /* D */
buf[8] == 0x43 && /* C */
buf[10] == 0x31 && /* 1 */
buf[12] == 0x2d && /* - */
buf[13] == 0x30 && /* 0 */
buf[13] == 0x34) || /* 4 */
(bufPos == 16 &&
buf[0] == 0x68 && /* Radio Source */
buf[6] == 0x54 && /* T */
buf[7] == 0x52 && /* R
buf[8] == 0x20 && /* "space" */
buf[9] == 0x30 && /* 0 */
buf[10] == 0x34)) /* 4 */

clutching at straws though!!!
 

·
Registered
Joined
·
43 Posts
Do you have to buy a new microcontroller or can you reprogram it? If you can reprogram it, do you have to unsolder it or could you do it without having to do some "manual labour"?

I'm asking because I am not very handy with a soldering iron but still want to get the "no video playback while driving"-project done somehow. ;)
 

·
Registered
Joined
·
10 Posts
Thanks all. Had a quick look through the ibus log. Definitely no messages containing the string CDC, and the whilst it contains a message with TR 04, it looks considerably different to that defined in ibus.c. Mine is a late 05 build M3, so yes consistent with your thoughts ccfj1.

Have just emailed ibus.txt to you PeteAU.
 

·
Registered
Joined
·
112 Posts
Hmmm, it should still switch on TR04 though!!!
 

·
Registered
Joined
·
43 Posts
Do you have to buy a new microcontroller or can you reprogram it? If you can reprogram it, do you have to unsolder it or could you do it without having to do some "manual labour"?
Nevermind. I noticed that there is the possibility for AVR ICSP on the pibus board. But if anyone showed me how to reprogram it, that would be great.

 

·
Registered
Joined
·
10 Posts
Reprogramming the ATtiny on the Pibus board

This really only takes a minute or 2 . . .

Buy any simple ATMEL capable programmer on ebay, BUT make sure it -
_comes with usb drivers for your operating system (or links to download them)
_can be controlled via AVRDUDE
_has a 2x5 header cable (or a 1x6 to 2x5 adaptor)

Download a version of AVRDUDE for your operating system that has ATtiny 2313 in its list of supported microcontrollers.
(You may also get AVRDUDESS which is a gui shell for lazy users, however it is a little limited. After all you'll only be typing 100 charactors at most.)

Install the programmer and AVRDUDE programs.

Download the ibusxxxxxxxx.hex file you wish to upgrade to. Extract it if it is inside a package.

+----------------------------------------------------------------------------------------

Copy the iBusxxxxxxxx.hex file to the directory AVRDUDE is stored in
Enter a command shell environment - Windows users type 'cmd' in the Start | Search box
Change to the directory AVRDUDE is installed in - C:/> cd /AVR
Connect the ATMEL programmer to your PC (mine is a usbtiny)
Connect the PiBus to the ATMEL programmer
_Note - the PiBus must be bare, nothing else connected to it.

+----------------------------------------------------------------------------------------
Programming -
Check that it recognizes the microcontroller - C:\AVR> avrdude -p t2313a -c usbtiny

_Note if using a different program to avrdude you often can turn off "target identification" so that a t2313, t2313A, t2313S or t2313V may all be programmed using the t2313 config file.

Burn the .hex file - C:\AVR> avrdude -p t2313a -c usbtiny -e -U flash:w:ibusxxxxxxxxx.hex

_Note capital U for Up loading (a lower case u forces unsafe fuse checking)

+----------------------------------------------------------------------------------------

If you are writing to a new 2313A the fuses will have to be set too -

Burn the fuses - C:\AVR> avrdude -p t2313a -c usbtiny -u -U efuse:w:0xff:m -U hfuse:w:0x9f:m -U lfuse:w:0x7d:m

_Note :m means read values from the command line instead of from a file
_Note you have to use unsafe fuse checking when changing fuse values.
+----------------------------------------------------------------------------------------

Unplug the PiBus and test it.

bye.
 

·
Registered
Joined
·
112 Posts
Whats the best way to compile a new HEX file?
 

·
Registered
Joined
·
5,273 Posts
So while I was driving home on the freeway today my indicators decided to stop working, my nav screen turned off and my wipers thought it was raining!!
It went back to normal after dropping Netgun off home, but when I left it did it again! I had to pull over and disconnect the pibus and it all went back to normal. That was fun!
 

·
Registered
Joined
·
541 Posts
Discussion Starter #256
So while I was driving home on the freeway today my indicators decided to stop working, my nav screen turned off and my wipers thought it was raining!!
It went back to normal after dropping Netgun off home, but when I left it did it again! I had to pull over and disconnect the pibus and it all went back to normal. That was fun!
That sucks. Something must have come loose, cracked, come-off from vibration I would imagine. IMO I don't like the look (from your photo) of only isolating the board from the metal CDC frame with tape. The pins at the bottom could eventually punch through and touch ground.
 

·
Registered
Joined
·
43 Posts
I have another question concerning re-programming.
Does the pibus forward all ibus messages to the Raspberry Pi? I want to send a message/signal/keypress to the RPi if the key is removed from the ignition lock.
The ibus message for that is 44 05 bf 74 00 ff + Checksum. Do I have to change the code for the attiny or for the linux software or both?

I thought I had to modify the attiny but taking a closer look I think the attiny somehow forwards the messages to the RPi and the linux software emulates the keypresses. My first attempt would be to add my lines of code to the "ibus.c" in the rpi directory.

Also: which IDE on which operating system did you use to develop the linux software?
 

·
Registered
Joined
·
5,273 Posts
That sucks. Something must have come loose, cracked, come-off from vibration I would imagine. IMO I don't like the look (from your photo) of only isolating the board from the metal CDC frame with tape. The pins at the bottom could eventually punch through and touch ground.

My mount is actually on 3mm perspex secured by Velcro Pete.
 

·
Registered
Joined
·
79 Posts
Hi All,

A great Installation tutorial from bgennette. :thumbsup:

PiBUS - Raspberry Pi in an IBus BMW

+----------------------------------------------------------------------------------------------------------
Run Paragon ExtFS for Windows (not required for linux) to add files to the Ext part of the SD card -
Copy the pibus-xxxxxxxx file onto the ext formatted part of the SD card (named /storage)
Copy pm3-hd.zip onto /storage (Note - do not unzip inner package)
Load some of your media content into /storage/xxx on the SD Card.
Note - while running /system is read-only and locked away, put all your config and media files on /storage
Note - ext file systems use a forward slash between directory names, not Windows style backslash.
Note - Windows file managers show disk names starting with upper case (even if they are lower case!), be sure to always type /storage with all lower case.
+----------------------------------------------------------------------------------------------------------
Just a little clarification here... Quoted above bgennette says "Copy the pibus-xxxxxxxx file onto the ext formatted part of the SD card (named /storage)"

Are you referring to the entire directory resulting from unzipping the pibus software?

I just copied the file "pibus" from the "rpi" folder to /storage which worked for me.

Just one more question to all...
Has any one tried using any of the available XBMC plugins for example the openbm plugin which allows XBMC to display BC info?

I don't see any reason why plugins shouldn't work I've just not had the time try yet.
 
241 - 260 of 2022 Posts
Top