Post Go back to editing

MAX22200 Serial-Controlled Solenoid and Motor Driver SPI Communication Problem

Category: Software
Product Number: MAX22200ETJ+
Software Version: stm32h747

Hello,

I am trying to read MAX22200 Serial-Controlled Solenoid and Motor Driver data with spi communication. I ran into a few problems and frankly, I couldn't find many examples on the internet so I wanted to ask here.

When I examined the datasheet, I read that I had to send the Command Register to the sensor first and then write data or read data.

For example, when I energize, I want to read the STATUS Register Address(0x00) data of the sensor. I am sending 0x80 by SDI as Command Register. 

In order to be able to read 32-bit data after the data, I send 0x00 by SDI, since no information is given on the datasheet side, I read 0x00 by SDO.

The question mark point stuck in my head here is actually when I change any bit of the STATUS Register, I still read 0x00.

Topics on my mind,

  •  While the command register is sending 8-bit data, only the CMD pin will be made HIGH-LOW, then it should always stay LOW, right?
  • The bit 0x02 status referred to as STATUS[0:7] is understood as FAULT, but what is the status it returns by default?
  • Can you share sample code that I can review on this topic?

Edit Notes

naming error fixed.
[edited by: aemiroglu at 6:19 AM (GMT -4) on 14 Jul 2023]
Parents
  • Some comments:

    • The CMD pin should only be pulled high right before writing to the command register, otherwise that line should be pulled low.
    • The bits returned by STATUS[7:0] depend on whether you have initialized the part or not. Figure 6 in the MAX22200 IC datasheet shows the programming flow chart. On the first read of the status register, STATUS[7:0] will show 0x02. After the status register is set and the channels are configured, reading STATUS[7:0] will show 0x03. A final read will show 0x01, which means the channels can now be turned on and certain on-the-fly actions can be performed. For normal operation, STATUS[7:0] will read 0x01 (no fault flags triggered and device is active).
    • The Pmod board for the MAX22200 IC (which is used with the TMCM-0960-MotionPy V21) will be out soon, but for now here are the links to the Python driver which is used for that board. The max22200pmb.py file is an example script that initializes the board and sets up Channel 0. You can see that the initialization follows the programming flowchart from the datasheet. The max22200.py file provides all the functions used in the example script.


    You wrote that you sent 0x80 to the command register to read the status register, but you should be sending 0x00 instead. Sending 0x80 tells the command register that your next action is writing to the status register. Can you confirm that when you are writing to the status register, the command register is set up properly?

Reply
  • Some comments:

    • The CMD pin should only be pulled high right before writing to the command register, otherwise that line should be pulled low.
    • The bits returned by STATUS[7:0] depend on whether you have initialized the part or not. Figure 6 in the MAX22200 IC datasheet shows the programming flow chart. On the first read of the status register, STATUS[7:0] will show 0x02. After the status register is set and the channels are configured, reading STATUS[7:0] will show 0x03. A final read will show 0x01, which means the channels can now be turned on and certain on-the-fly actions can be performed. For normal operation, STATUS[7:0] will read 0x01 (no fault flags triggered and device is active).
    • The Pmod board for the MAX22200 IC (which is used with the TMCM-0960-MotionPy V21) will be out soon, but for now here are the links to the Python driver which is used for that board. The max22200pmb.py file is an example script that initializes the board and sets up Channel 0. You can see that the initialization follows the programming flowchart from the datasheet. The max22200.py file provides all the functions used in the example script.


    You wrote that you sent 0x80 to the command register to read the status register, but you should be sending 0x00 instead. Sending 0x80 tells the command register that your next action is writing to the status register. Can you confirm that when you are writing to the status register, the command register is set up properly?

Children
No Data