0
\$\begingroup\$

I am currently designing a FOC motor driver with a MCF8316C chip from TI and I am having quite a lot of troubles to get it to work. I plan on controlling it with a PWM signal coming from a Nucleo-f429zi board from stmicroelectronics.

The chip default setting is for it to work with analog input. It is possible to change that by changing the register with I²C commands. However, I understood from the TI Forum that the protocol of the device is flawed (unusual ID, needs delay between each byte package or to set the speed to 10 kHz instead of 100kHz). I’ve done all that but the driver just won’t work I am relatively new to coding so I am a bit lost.

So far I’ve sent the config that i want to the register, then sent the command to save the config in the shadow register to the eeprom, then tried to read the changed register but the output doesn’t make sense. Instead of having 0x00000001, I have 0x003f59b0. Since the default setting is 0x00000000 and I haven’t changed anything else I don’t understant why I have this. I looked at the frame sent and I don’t see anything wrong.

Here is the code I am using:

''' Code '''

Here is the link of the datasheet : https://www.ti.com/lit/ds/symlink/mcf8316c-q1.pdf

Here is the schematic of the board with the driver enter image description here

The code I am using :

enter image description here enter image description here enter image description here

And here are graphs of the data sent and received

enter image description here

enter image description here

enter image description here

Someone has any idea on what I am doing wrong?

\$\endgroup\$
3
  • \$\begingroup\$ Are you sure the MCU I2C interface is configured properly for open-drain IO? \$\endgroup\$
    – Justme
    Commented Nov 30 at 12:59
  • 2
    \$\begingroup\$ Please don't post your code as image. Post it as a code block (in the Edit mode, click {} on a new line, and past your code). \$\endgroup\$
    – hcheung
    Commented Nov 30 at 13:05
  • \$\begingroup\$ What is your defined MCP8316_DEVICE_ADDR_WRITE value? The datasheet said "Target ID and R/W Bit: The first byte includes the 7-bit I2C target ID, followed by the read/write command bit" (i.e. shift A6-A0 up by one bit and add 0 as the Lowest bit for WRITE operation). so if Target I2C ID is 0x01, the MCP8316_DEVICE_ADDR_WRITE should be 0x02. But your scrope shows that you are sending 0x01. \$\endgroup\$
    – hcheung
    Commented Nov 30 at 13:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.