Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[moved] How to find the register address of a slave device

Status
Not open for further replies.

ghoral

Newbie level 6
Joined
Apr 4, 2019
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
113
Hi,
I am doing a project on RFID rc522 on avr atmega32 using I2c . I was able to find the device address(0101b, the rest 3 bits are configured by the user) that give slave address of 0x50 but now how do I find the specific register address to write and read from. I dont know where should I look for it and how do I find it. I have attached the datasheet of this device.
 

Attachments

  • MFRC522.pdf
    813.7 KB · Views: 161

Re: How to find the register address of a slave device

Hi,

It is like with most I2C devices:
* 7 bits device address
* 1 bit R/W
* ACK
* 8 bits register address --> Table 20
* ACK
* n times ( 8 bit data + 1 bit ACK)

Klaus
 

Re: How to find the register address of a slave device

Thankyou for your response.. It has the address of 0101 000(0x50) so does it mean 0x50+0 is used register address. or are you refering to FIF0 dataregister in table 20.
 

Hi,

As you can read in the datasheet and in my example above: register address is independent of device address (0x50).

Register address has nothing to do with 0x50.


Klaus
 

Yes..that's why I want to know the register address to write the data.. Can you please write the register address. This has me stuck for days. And in the datasheet there is nowhere register address is mentioned or I failed to understand it. Only the device address is given as I have written above.
 

Hi,

This has me stuck for days. And in the datasheet there is nowhere register address is mentioned or I failed to understand it.
Nonsense.

you have several options to find the solution to your problem:
* read the datasheet
* use the search function of your PDF reader to find "register address"
* Read my post#2: "* 8 bits register address --> Table 20"

Klaus
 

Yes..that's why I want to know the register address to write the data.. Can you please write the register address. This has me stuck for days. And in the datasheet there is nowhere register address is mentioned or I failed to understand it. Only the device address is given as I have written above.

the register addresses are very much mentioned in the datasheet you have shared above. They are all listed in Section 9 onwards in great detail. Why the confusion ?
 
Last edited:

I can't understand the query either, all the register addresses are listed on pages 36 & 37 of the data sheet. It even references in detail the pages where the bits in each register are described.

The I2C address is mostly decided by the logic levels on the pins of the device, you chose it then enable the device by sending that address on the I2C bus.

Brian.
 

Looks like OP wanted to know how to send register address, if so it would be like this

Writting to register
I2C1_Init(100000); // initialize I2C communication
I2C1_Start(); // issue I2C start signal
I2C1_Wr(SLAVE_ADDRESS); // send byte via I2C (device address + W)
I2C1_Wr(write_register); // send byte (register address) *Register address here from page 20, look into list and see what address you want to write to,
I2C1_Wr(0xAA); // send data (data to be written)
I2C1_Stop(); // issue I2C stop signal

Reading from register
I2C1_Start(); // issue I2C start signal
I2C1_Wr(SLAVE_ADDRESS); // send byte via I2C (device address + W)
I2C1_Wr(write_register); // send byte (register address)
I2C1_Repeated_Start(); // issue I2C signal repeated start
I2C1_Wr(SLAVE_ADDRESS + 1); // send byte (device address + R)
read_value = I2C1_Rd(0u); // Read the data (NO acknowledge)
I2C1_Stop();
 

Likely I have a good library for this chip borrowed from one guy and rewritten from cpp to c
https://bitbucket.org/Virviglaz/mylibraries/src/master/Common/MFRC522.c
https://bitbucket.org/Virviglaz/mylibraries/src/master/Common/MFRC522.h
You need to provide this functions to make it working:
void (*WriteData)(char reg, char * buf, char size);
void (*ReadData) (char reg, char * buf, char size);
void (*Delay_Func)(uint32_t us);
Delay is needed only for initial part. Interface can by different - it supports spi, i2c and uart.
 

Thank you so much..You understood this is what I needed..I was struggling on I2C1_wr(write _address) I didnot know what register I have to use in this function even when I looked at the datasheet. Now I got it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top