Radio Data System (RDS) > MRDS1322
Micro RDS i2c
Ken:
Hi,
I'm trying to control my MicroRDS via i2c from an Arduino. But without any success. I run in Mode 3, and if I listen to the radio (only RDS) I hear a tiny "noice" after I sent a I2C message.
I scanned my I2C buss and found that MRDS1322 was on Adress 0x6B, is that correct?
Here is how I did:
PTY (from doc page 11)
--- Code: ---
Wire.beginTransmission(0x6B); //Adress of MRDS1322
Wire.write(0xFE); //Start byte
Wire.write(0xD6); //Control byte ?? // I tried with and without
Wire.write(0x0A); //Adress PTY
Wire.write(0x0F); // Data 15 (Other M)
Wire.write(0xFF); //End byte
error = Wire.endTransmission();
if (error == 0) //0:success
Serial.println("I2C device OK!");
else
Serial.println("Error: No I2C device");
--- End code ---
And this for PS
--- Code: ---
Wire.beginTransmission(0x6B); //Adress of MRDS1322
Wire.write(0xFE); //Start byte
Wire.write(0xD6); //Control byte ??
//SET PS "MY-RADIO"
Wire.write(0xC8); //Adress PS
Wire.write("M"); // Data
Wire.write(0xC9); //Adress PS
Wire.write("Y"); // Data
Wire.write(0xCA); //Adress PS
Wire.write("-"); // Data
Wire.write(0xCB); //Adress PS
Wire.write("R"); // Data
Wire.write(0xCC); //Adress PS
Wire.write("A"); // Data
Wire.write(0xCD); //Adress PS
Wire.write("D"); // Data
Wire.write(0xCE); //Adress PS
Wire.write("I"); // Data
Wire.write(0xCF); //Adress PS
Wire.write("O"); // Data
Wire.write(0xFF); //End byte
error = Wire.endTransmission();
if (error == 0) //0:success
Serial.println("I2C device OK!");
else
Serial.println("Error: No I2C device");
--- End code ---
All help is welcome.
Thanks!
/Ken
Jan:
That code is not correct. Please look again at the I2C communication as described in the mrds1322.pdf datasheet.
Mistakes I see:
1) The PTY code does not correspond to the figure 5.7 at all.
2) Control byte (the MRDS1322 address) is not 0x6B but 0xD6 for write operation.
3) There are no start bytes and end bytes when using I2C.
4) Control byte is sent only once as a first byte in each start-stop session.
5) Address byte is sent only once as a second byte in each start-stop session. The address is auto-incremented after receiving each next byte of data.
6) I'm missing I2C stop command in your code.
Please refer to the I2C specification for more details about this bus.
Take note that the I2C bus is not trivial, it is preferred to use a logical analyzer with I2C protocol decoder to ensure that the master generates correct signals.
Ken:
Hi,
OK I got PTY working, but not with 0xD6 as the Adress of MRDS1322. 0x6B works.
--- Code: ---
Wire.beginTransmission(0x6B); //Adress of MRDS1322
Wire.write(0x0A); //Adress PTY
Wire.write(0x0F); // Data 15 (Other M)
Wire.endTransmission();
--- End code ---
I think Wire.endTransmission is sending the stop command you ask for.
Jan:
0x6B is 0xD6 shifted right by one bit, i.e. not including the read/write bit. Physically the hardware must send 0xD6 as a control byte. Thus the argument of the Wire.beginTransmission function seems to be the 7-bit device address only, without read/write selection. A documentation for this function should tell more.
Ken:
OK but I got everything working now even PS and RT.
Is it possible to sent RT+ with use of User Defined Group, or is RT+ only working with Pira32 and Pira132?
/Ken
Navigation
[0] Message Index
[#] Next page
Go to full version