http://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Bus_Protocol&feed=atom&action=historyMazda Entertainment System - Bus Protocol - Revision history2024-03-29T07:06:58ZRevision history for this page on the wikiMediaWiki 1.35.0http://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Bus_Protocol&diff=53&oldid=prevNikosapi: 1 revision2013-09-14T02:16:28Z<p>1 revision</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<tr class="diff-title" lang="en-CA">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 02:16, 14 September 2013</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en-CA"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Bus_Protocol&diff=52&oldid=prevNikosapi: Undo revision 1006 by Parrishcartwright (Talk)2011-11-07T19:21:16Z<p>Undo revision 1006 by <a href="/w/index.php/Special:Contributions/Parrishcartwright" title="Special:Contributions/Parrishcartwright">Parrishcartwright</a> (<a href="/w/index.php?title=User_talk:Parrishcartwright&action=edit&redlink=1" class="new" title="User talk:Parrishcartwright (page does not exist)">Talk</a>)</p>
<p><b>New page</b></p><div>The message bus on Mazda head units use a simple communication protocol. The bus idles at 5V and is pulled down to 0V to send data pulses. Logical ones and zeros are defined by how long the bus is pulled down, see [[#Timing|Timing]] for details. The protocol uses nibbles instead of bytes; most messages don't line up to a byte boundary (for instance, the shortest message is 12 bits).<br />
<br />
==Message Protocol==<br />
<br />
{|border="1"<br />
! Purpose<br />
! Length (nibbles)<br />
! Notes<br />
|-<br />
|Destination Module<br />
|1<br />
|<br />
0x0 = Tape deck<br><br />
0x1 = (Unknown)<br><br />
0x3 = CD deck<br><br />
0x5 = CD changer (external)<br><br />
0x6 = CD changer (upper module)<br><br />
0x7 = MD deck<br><br />
0x8 = Base unit<br><br />
<br />
If the first bit of this nibble is 1, the command is destined for the base unit and the remaining 3 bits let the base unit know which module it came from. Therefore if the CD deck wants to send a message to the base unit this nibble will be 0x3 + 0x8 which is 0xB (or b1011). If the first bit is 0, then the message originates from the base unit.<br />
|-<br />
|Command<br />
|1<br />
|<br />
|- <br />
|Message data<br />
|0..n<br />
|Message specific<br />
|-<br />
|Checksum<br />
|1<br />
|<br />
XOR all the nibbles, add 1 and ignore any overflow.<br><br />
Example: If the message is 0x311012, the checksum calculated as follows: (3^1^1^0^1^2 + 1) & 0xF = 1<br />
|}<br />
<br />
<br />
===Messages Sent By The Base Unit===<br />
{| border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
|-<br />
|0x1<br />
|4 or 5<br />
|Control<br />
|See [[#Control Command Data Format|Control Command Data Format]]<br />
|-<br />
|0x8<br />
|0<br />
|Anybody home?<br />
|No data<br />
|-<br />
|0x9<br />
|0<br />
|Wake up<br />
|No data<br />
|}<br />
<br />
====Control Command Data Format====<br />
{| border="1"<br />
!Subcommand<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|1<br />
|Playback control<br />
|XX2<br />
|<br />
XX is:<br />
*0x01 for play<br />
*0x04 for ff<br />
*0x08 for rew<br />
*0x60 for stop<br />
|-<br />
|0x3<br />
|Seek to track<br />
|0KK1<br />
|KK is the (BCD encoded) track to seek to<br />
|-<br />
|0x4<br />
|Set configuration data (CD Deck)<br />
|RR00<br />
|RR is:<br />
*0x02 for random mode<br />
*0x08 for "SCAN" mode (plays 10s of each song)<br />
*0x40 for repeat mode<br />
|-<br />
|0x4<br />
|Set configuration data (Tape Deck)<br />
|RR0<br />
|RR is:<br />
*0x01 for repeat mode<br />
*0x02 for random mode<br />
*0x10 for fast fast-forwarding (when the up-seek button is pressed)<br />
*0x20 for fast rewinding (when the down-seek button is pressed)<br />
|}<br />
<br />
<br />
===Messages Sent by the CD Deck===<br />
{|border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|0x8<br />
|1<br />
|Wakeup notification<br />
|0x1<br />
|Sent after connecting power<br />
|-<br />
|0x9<br />
|13<br />
|Status<br />
|NPPQRSSTTWXYZ<br />
|N is:<br />
* 0x0 - stopped<br />
* 0x4 - playing<br />
* 0x5 - seeking<br />
* 0x6 - fast forwarding<br />
* 0x7 - rewinding<br />
<br />
PP is the current track number (BCD encoded)<br><br />
QR is unknown but suspected to be current CD number in a CD changer (always 0x01)<br><br />
SS is the current position in minutes (BCD encoded)<br><br />
TT is the current position in seconds (BCD encoded)<br><br />
W is 0x4 when repeat is on, 0x0 otherwise<br><br />
X is 0x2 when random is on, 0x0 otherwise<br><br />
Y is unknown (always seems to be 0x0)<br><br />
Z is unknown (always either 0x1 or 0xC)<br />
|-<br />
|0xB<br />
|9<br />
|Hardware status<br />
|various<br />
|<br />
0x910000001 - sent when the device enters playback mode<br><br />
0x91000000C - disk present (sent multiple times during startup if disk is present)<br><br />
0x91XX0000C - used when the radio is woken up, XX is current track number (BCD encoded)<br><br />
0xA0006000C - no disk present (always sent once during startup, after 0x8 command)<br><br />
0xA0008000C - ejecting<br><br />
0xB1006000C - disk being inserted<br />
|-<br />
|0xC<br />
|10<br />
|Disk info<br />
|STTWWXXYYZ<br />
|<br />
S is 0x0 for no CD, 0x1 for CD in drive<br><br />
TT is the BCD encoding of the first track number on the CD<br><br />
WW is the BCD encoding of the last track number on the CD<br><br />
XX is the BCD encoding of the total playing minutes<br><br />
YY is the BCD encoding of the total playing seconds<br><br />
Z seems to be 0x0 for no CD, 0xF otherwise<br />
|-<br />
|0xD<br />
|15<br />
|Unknown<br />
|<br />
0x000000000000000<br><br />
0x100000000000800<br />
|This may have something to do with whether or not a CD is present. The first format (0x000...) only appears when there is no CD in the drive and the second format (0x100...) only appears when there is a CD in the drive.<br />
|}<br />
<br />
<br />
===Messages Sent by the Tape Deck===<br />
{|border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|0x8<br />
|1<br />
|Wakeup notification<br />
|0x1<br />
|Sent after the base unit sends the first "Wake Up" command<br />
|-<br />
|0x9<br />
|2<br />
|Status<br />
|NP<br />
|N is:<br />
* 0x0 - stopped<br />
* 0x4 - playing<br />
* 0x5 - seeking<br />
* 0x6 - fast forwarding<br />
* 0x7 - rewinding<br />
<br />
P is 0x1 when the tape deck in use, 0xC for all other status messages (like on startup)<br />
|-<br />
|0xB<br />
|6<br />
|Detailed status<br />
|various<br />
|<br />
0x90X00C - sent during initialization, X is:<br />
* 0x0 for no cassette present<br />
* 0x4 for cassette present<br />
<br><br />
0x90Y001 - sent when the tape deck is in use, Y is:<br />
* 0x4 for normal playback<br />
* 0x5 when repeat mode is on<br />
* 0x6 when random mode is on<br />
<br><br />
0x9Z4011 - high speed fast-forward/rewind, Z is:<br />
* 0x2 for fast forward with the seek button<br />
* 0x3 for re-wind with the seek button<br />
<br><br />
0xA40004 - sent while the tape deck is ejecting<br><br />
0xA0000C - sent when the cassette is finally ejected<br><br />
<br />
0xB0400C - sent when a tape is inserted<br />
<br />
For any of these commands, when the Dolby noise reduction mode is on, the 4th nibble will be 0x1. For example: 0x904001 indicates normal playback, but with dolby noise reduction on it will be 0x904101.<br />
|}<br />
<br />
<br />
==Timing==<br />
<br />
The radio seems to be very forgiving when it comes to the duration of various signals. The CD player in particular is very inconsistent; in the same nibble it'll send a logical zero which lasts 0.4ms and then another that lasts 0.55ms, the radio doesn't seem to care.<br />
<br />
{| border="1"<br />
! Operation<br />
! Duration (milliseconds)<br />
|-<br />
|Logical 0<br />
| 0.4 - 0.6<br />
|-<br />
|Logical 1<br />
| 1.7<br />
|-<br />
|Wait after sending logical 0<br />
| 2.4<br />
|-<br />
|Wait after sending logical 1<br />
|1.2<br />
|-<br />
|Wait between nibbles<br />
|0 - 5<br />
|-<br />
|Wait between commands<br />
|10 - 50<br />
|}<br />
<br />
<br />
===Timing Diagrams===<br />
These diagrams are to give an idea of what timing is like on the bus. This particular diagram is of the initialization sequence (without the CD player). The x axis is in microseconds (10^-6 seconds).<br />
[[File:Mazda-cd-1.png|400px|none|thumb|The same 6 "Wake Up" commands are sent 4 times]]<br />
[[File:Mazda-cd-2.png|400px|none|thumb|Each command block is made up of 6 commands]]<br />
[[File:Mazda-cd-3.png|400px|none|thumb|The first command (0x38C)]]<br />
<br />
{{MazdaRadioSeeAlso}}</div>Nikosapi