AnsweredAssumed Answered

STEVAL-ESC001V1 I2C Interface

Question asked by Dave McCoy on Oct 18, 2017
Latest reply on Apr 13, 2018 by Matteo Maravita
Branched to a new discussion

Hello,

 

I've purchased an STEVAL-ESC001V1 ESC Evaluation board and, using the UART interface have demonstrated that the board is capable of driving the motors I want.

 

We are building a board with four of these ESCs on them to control a quadcopter. Due to certain constraints I am unable to use CAN to communicate between my main controller and the ESCs. Since I have four ESCs I will not be able to attach all four ESCs to one UART bus.

 

Fortunately, the page describing the ESCs say that it supports I2C communication:

 

I would like to use I2C to control the ESC. Nothing too elaborate. I just want to set a reference RPM and read back the current RPM of the motor.

 

Problem

 

 

The reference firmware project does not have the software that supports I2C in peripheral mode and there is no option within the 'ST Motor Control Workbench' that will allow me to select I2C.

 

No I2C Option For User Interface

 

I've demonstrated an I2C peripheral using an STM32F4 Discovery board using the HAL and I can probably get an I2C peripheral using the Low Level interface but this platform has neither of those APIs.

 

Things I've Tried

 

After looking through the code I found the 'USART Physical Communication Class' which is declared within the 'UILibrary' (User Interface Library) which calls a motor controller API so I think the correct approach would be to add an equivalent 'I2C Physical Communication Class' I've gone through the process of enabling I2C.

 

Specifically I create a new define statement called 'I2C_COMMUNICATION' which enabled the UI_Task

 

I have added the following files to the UILibrary:

 

inc/I2C_PhysicalLayerCommunciation_Private.h

interface/I2C_PhysicalLayerCommunication_Class.h

src/I2C_PhysicalLayerCommunication_Class.c

 

In the project directory I've added an I2C_Params.h file which can be used to configure the I2C specific configuration.

 

Current Issue

 

I think if I can at least demonstrate a simple I2C slave communication. Where I write a value to the ESC and read a value back I would have a chance to get things working but at the moment I'm running into a very simple issue. I can't see an interrupt when I attempt to communicate with the board.

 

I've been using this device

 

Analog Discovery 2 

 

to send I2C packets to the device and have successfully demonstrated it works with the previously mentioned STM32F4 discovery board but at the moment I do not enter the I2C event interrupt.

 

Would someone look at my 'Web/UILibrary/src/I2C_PhysicalLayerCommuncation_Class.c' file and see if there is something I'm doing wrong?

 

The github URL is:

 

stesc-001v1-i2c/I2C_PhysicalLayerCommunication_Class.c at master · CospanDesign/stesc-001v1-i2c · GitHub 

 

Any help would be greatly appreciated.

 

Dave

Outcomes