Hi Team,
I am interfacing [ACS71020][https://www.allegromicro.com/~/media/Fi ... sheet.ashx] with ESP32. I code ESP32 using Arduino IDE. I want to interface this IC with ESP32 using SPI communication. Its SPI frame like below.
I need to send 7 bits of address 1 bit of read/write which makes 1 byte. But after that, I need to read 32 bytes of data from this IC or I need to write 32 bytes of data to this IC.
If I want to read 32-bits of data, I need to send dummy 4 bytes on the MOSI line so that I will get data on the MISO line. I don't know, which register to read in this case. Can you guide me on this, please? Or do you have better suggestion to interface this IC?
Till now I have been successful in writing SPI data to other devices ex. Arduino UNO as a slave. I have attached my code below for such SPI data write.
But I need assistance to read from ACS71020 ic. Can somebody guide me on how to read 32-bit data using SPI communication.
Thanks in advance,
Akshay Godase
Interfacing of ACS71020 using SPI
- jgustavoam
- Posts: 165
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: Interfacing of ACS71020 using SPI
Hi Askhay,
First, you must select the appropriate model for your option:
ACS71020KMABTR-030B3-SPI (VCC = 3,3V and SPI interface).
Maximum SPI Clock Frequency = 10 MHz (I suggest you do initial tests with 1 MHz)
"It is recommended that the ACS71020 be the only device on the SPI bus if using SPI communication."
The most common mode of the SPI protocol is SPI Mode 0 - MSB First. I think it will work.
https://en.wikipedia.org/wiki/Serial_Pe ... _Interface
https://github.com/espressif/arduino-es ... raries/SPI
Example:
https://github.com/espressif/arduino-es ... _Buses.ino
First, you must select the appropriate model for your option:
ACS71020KMABTR-030B3-SPI (VCC = 3,3V and SPI interface).
Maximum SPI Clock Frequency = 10 MHz (I suggest you do initial tests with 1 MHz)
"It is recommended that the ACS71020 be the only device on the SPI bus if using SPI communication."
The most common mode of the SPI protocol is SPI Mode 0 - MSB First. I think it will work.
https://en.wikipedia.org/wiki/Serial_Pe ... _Interface
https://github.com/espressif/arduino-es ... raries/SPI
Example:
https://github.com/espressif/arduino-es ... _Buses.ino
Retired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
- jgustavoam
- Posts: 165
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: Interfacing of ACS71020 using SPI
Did you understand all about of this information?
" The SPI frame consists of:
• The Master writes on the MOSI line the 7-bit address of the
register to be read from or written to.
• The next bit on the MOSI line is the read/write (RW) indicator.
A high state indicates a Read and a low state indicates a Write.
• The device sends a 32-bit response on the MISO line. The
contents correspond to the previous command.
• On the MOSI line, if the current command is a write, the 32
bits correspond to the Write data, and in the case of a read, the
data is ignored"
EEPROM/Shadow Memory range of addresses = 0x0B to 0x01F. (all with 32 bits)
Volatile Memory range of adresses = 0x20 to 0x31. (all with 32 bits)
You can write or read all of these memory registers.
First try - you must read the value = 0x4F70656E
Register 0x2F
Bits Name Description
31:0 access_code Access code register:
Customer code: 0x4F70656E
" The SPI frame consists of:
• The Master writes on the MOSI line the 7-bit address of the
register to be read from or written to.
• The next bit on the MOSI line is the read/write (RW) indicator.
A high state indicates a Read and a low state indicates a Write.
• The device sends a 32-bit response on the MISO line. The
contents correspond to the previous command.
• On the MOSI line, if the current command is a write, the 32
bits correspond to the Write data, and in the case of a read, the
data is ignored"
EEPROM/Shadow Memory range of addresses = 0x0B to 0x01F. (all with 32 bits)
Volatile Memory range of adresses = 0x20 to 0x31. (all with 32 bits)
You can write or read all of these memory registers.
First try - you must read the value = 0x4F70656E
Register 0x2F
Bits Name Description
31:0 access_code Access code register:
Customer code: 0x4F70656E
Retired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
Re: Interfacing of ACS71020 using SPI
Hi there,
Thanks for this kind reply. I will try your recommendations and get back to you if I face any problem.
Thanks,
Akshay Godase
Thanks for this kind reply. I will try your recommendations and get back to you if I face any problem.
Thanks,
Akshay Godase
Who is online
Users browsing this forum: No registered users and 36 guests