I am trying to work with the FRDM33771BSPIEVB with MC33771B battery cell controller IC for BMS and I'm trying to use it with Arduino R3. I want to establish SPI communication between the board and the arduino and I am using the Arduino IDE to program the Arduino. Could somebody guide me on how to establish SPI communication between the board and arduino ?. It would also be very helpful if I could get some reference materials to study on. Thank you very much. ( It would be very kind if you redirect people in your network with experience working on this )
I do not have much experience/recommendations for interfacing the FRDM33771BSPIEVB with Arduino boards.
However, you might find useful our MC3377x software driver including example projects for S32K144EVB-Q100 board available at Embedded SW: MC33771/MC33772 SW Driver | NXP
In addition to that, there is the AN12084 (MC33771B/MC33772B programming guide) providing basic guidelines for configuration and programming of the MC3377x. However, it is currently available for download from DocStore under NDA (Non-Disclosure Agreement) only:
Thank you very much TomasVaverka for the information provided. I would like you to know that I already have the AN12084 guide. I went through it and I could not find any example to get the gist of it. I will briefly walk you through the details of my progress.
First I powered the board using a 18V battery cell (POS_BAT and NEG_BAT test points on the board). I am getting 5.01 V between VCOM and CGND on the chip and 4.3 V between Vspi_com_en and CGND. Also the VCOM_LED is glowing continuously. So by this it means the board is ready for SPI communication, right?.
Then I tried send NO-operation commands. Here is where I have a doubt. Can we send NO-operation commands to the board before initializing it?. IF yes, then are some of these atleast valid NO-operation commands?
01010100E0 / 010101045C / 01010108B7 / 0101010C0B / 010101104E / 01010114F2 / 0101011819 / 0101011CA5
Could you also help me in understanding what CID and RC fields are (in regards to SPI communication) ?.
It would be very kind of you to help me with this. Thanks in advance for your time.
First make sure you are using correct SPI timing:
Note that SPI “Mode 1” is used, which means that an inactive state of clock signal is low (CPOL = 0), input data are latched on falling edge of the clock signal and output data changed on the rising edge (CPHA = 1).
SPI input signal levels to the MC33771 operate at 5.0V logic levels, but are 3.3V compatible. The SO output driver provides 5.0V levels only and therefore must be attenuated to be compatible with a 3.3V MCU.
Each SPI message consists of 40 bits (means CSB low -> 40 bits -> CSB high) and six fields:
1. Memory data - 16 bits - the data itself
2. Master / Slave - 1 bit (0 = master - write, 1 = slave - respond)
3. Memory address - 7 bits - register address
4. Device address - 4 bits - address of the node (CID = Cluster ID)
5. Tag ID - 4 bits - controller initiates it for each conversion and MC33771 response must contain the same Tag ID.
6. CRC - 8 bits - cyclic redundancy check (attached is an example calculation).
In SPI mode, the initialization only consists in writing INIT[CID] = 1 followed by a read command of the INIT register.
Then the MC33771 registers need to be programmed for the device to work as required by the application (there is an example sequence in the AN12084).