STA013 trouble, I need ur help!

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys,

I use I2C communication of Atmega32L, interactive with STA013 Mpeg decode, but i have some trouble..

- I sent I2C_start OK, checksum OK
- I sent I2C_SL_W OK, checksum is 0x18 SL_W and ACK returned (match the Atmega32L datasheet)
- then I load 0x01 to write to STA by the next instruction.
- I sent I2C_write_byte OK, checksum is 0x30 Data and NACK returned

- I sent I2C_re_start OK

- I sent I2C_SL_R but now, checksum is 0x48 meaning address and NACK returned.

All i want first is read the content of address 0x01 from STA. But I can't read anything cause STA always send back my request with NACK, meaning stop connection...

Do u think this's cause by anything, plz help me solve this maze. It's the only one STA i'v got and it'll be so terrible if smth happend to it :cry:

P/S: I use STK500 board, to connect with STA, i use PORTC 0-5 for I2C comm, SDI,CLK for data to STA, RESET and DATA_REQ. RESET is active low, so i've already set this bit high.

My atmega run at 8Mhz, I2C freq = 100kHz... If you need more info or code... plz tell me.

Thanks for ur help!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry to break up your invention hobby. But AVRLib has the library to access STA013 conveniently. http://hubbard.engr.scu.edu/embedded/avr/avrlib
But if you want to make it yourself, still you can use AVRLib's i2c library (again not to break up your invention hobby)... :mrgreen:

KISS - Keep It Simple Stupid!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another info, that when i checked the checksum after sending I2C_SL_W or I2C_SL_R, the checksum always tell that NACK is returned...

Whatever i sent to STA, except I2C_START (0x08), all the checksum is 0x.... that meaning about NACK: 0x20,0x30,0x48...

I dont know whats wrong :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yah, I dont know that ur repling.. I'll check this lib. Hopefully it can works.
Thanks ya :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, it's seem not make a sense. Have you been working with I2C that the acknowledge bit always is 1(NACK)? If it is, what the problem could be?

Common', I need your help :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Acknowledge bit always 1 (NACK) maybe caused by wrong I2C addressing scheme. I've done testing with simple I2C devices like DS1302 RTC, AT24C04 SEEPROM, and tried to mistype the slave address. The result for each communication ends up with NACK.

KISS - Keep It Simple Stupid!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The address in read and write is right, 0x86 and 0x87 like the datasheet tell me...

But when trying to solve this, i realized that when i remove the data cable for I2C comm, the replies is exactly the same as above. Maybe it's mean my STA is already death??? :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try this website on how to use the sta013. I'm also designing a player using this chip, maybe we can help each other.

http://www.pjrc.com/tech/mp3/sta...

Edit: I just found this and it might solve your problem ( read this first before going to above site )

Quote:
I2C interface is used for initializing and controlling the decoder. The decoder needs an initialization file called p02_0609.bin. The file consists of 2007 lines. Each line has a register number and its value. This file needs to be sent to the decoder just after reset before the decoder can start normal operation. I stored this file in the program memory using the .db directive. You can use the p02_0609.inc version of this file in your program. The first time I sent this file to the decoder, the decoder did not work. After couple hours of debugging, I found out that the 'DATA_REQ_ENABLE' command was causing problems. So, I sent this command before sending the file. The order of commands I send is:

*

Read IDENT register (0x01). The value read should be 0xAC
*

Write 0x04 to DATA_REQ_ENABLE register (0x18)
*

Read DATA_REQ_ENABLE register (0x18)
*

Send the 2007 words from the p02_0609.inc file. I waited for 30ms after sending the SOFT_RESET command (0x10) which is one of the commands in the file. This command is said to cause problems without this delay.
*

Write 0x01to RUN register (0x72)
*

Write 0x01to PLAY register (0x13)

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1