The file dsc_config.h must be provided in the application source code. This file can set the following defines:
PWM_DEAD_TIME
This is the period, in 10ns intervals, which is not counted towards the PWM time as the PWM is output.
PWM_MAX_VALUE
The PWM input is clamped to this value
LOCK_ADC_TO_PWM
If this is defined, the PWM outputs synchronization information to a channel and dummy port, allowing the ADC module to synchronize the ADC measurement to the dead time when all PWM channels are off.
NUMBER_OF_POLES
This is the number of poles in the motor. It is therefore ratio of the number of electrical rotations to each physical rotation. If a motor has a single winding per coil, then it is called a 2 pole motor. Two sets of windings per coil makes a four pole motor, and so on.
USE_CAN
When defined, the CAN controller in included in the executable. This option is mutually exclusive with Ethernet.
USE_ETH
When defined, the Ethernet controller is included in the executable. This option is mutually exclusive with CAN.
TCP_CONTROL_PORT
When the Ethernet controller is included, this is the TCP port that the server listens on, for receiving control information.
MIN_RPM
The minimum RPM that the controllers can set.
MAX_RPM
The maximum RPM that the controllers can set.
For documentation on the Ethernet, CAN and PWM modules, see the relevent XMOS software module documentation.
ADC calibration sequence.
This switches the ADC server into calibration mode. After a number (512) of samples the server reverts to non-calibration mode, and subsequent calls to the function get_adc_vals_calibrated_int16 will take the measured average of the calibration period as an offset
Parameters: |
|
---|
Get values converted from 14 bit unsigned to 16 bit signed and calibrated.
Read a set of current values from the motor, and convert them into a standardized 16 bit scale
Parameters: |
|
---|
Implements the AD7265 triggered ADC service.
This implements the AD hardware interface to the 7265 ADC device. It has two ports to allow reading two simultaneous current readings for a single motor.
Parameters: |
|
---|
Execute the triggered ADC server.
This is the server thread implementation for the LTC1408 ADC device.
Parameters: |
|
---|
The server thread for the MAX1379 ADC device.
Implements the server thread for the MAX1379 ADC device
Parameters: |
|
---|
Get the position from the QEI server.
Parameters: |
|
---|---|
Returns: | the speed, position and valid state |
Implementation of the QEI server thread.
Parameters: |
|
---|
Implementation of the QEI server thread that services multiple QEI devices.
Parameters: |
|
---|
Get position, speed and delta from a hall server.
The client library function for a hall sensor server
Parameters: |
|
---|
A blocking read of the hall port.
Parameters: |
|
---|
A selectable read of the hall pins.
This selectable function becomes ready when the hall pins change state
Parameters: |
|
---|
A basic hall encoder server.
This implements the basic hall sensor server
Parameters: |
|
---|
A hall encoder server that also calculates motor speed.
This implements the hall sensor server
Parameters: |
|
---|
A hall encoder server that also calculates motor speed.
This implements the hall sensor server, where the speed is calculated using a timed average of many values.
Parameters: |
|
---|
A hall encoder server that also calculates motor speed.
This implements the hall sensor server, where the speed is calculated using a timed average of many values.
Parameters: |
|
---|
Perform a Park transform.
A Park transform is a 2D to 2D transform which takes the radial and tangential components of a measurement (for instance the magnetic flux or total coil currents) and converts them to a rotating frame of reference. Typically this is the rotating frame of reference attached to the spinning rotor.
Parameters: |
|
---|
Perform an inverse Park transform.
A Park transform is a 2D to 2D transform which takes the radial and tangential components of a measurement (for instance the magnetic flux or total coil currents) and converts them to a rotating frame of reference. Typically this is the rotating frame of reference attached to the spinning rotor.
Parameters: |
|
---|
Perform a clarke transform.
A Clarke transform is a 3D to 2D transformation where the 3D components have only 2 degrees of freedom. It is used to convert the three current values in the 120 degree separation coils into a radial and tangential component values.
Parameters: |
|
---|
Perform an inverse clarke transform.
The inverse Clarke transform is a 2D to 3D transformation where the 3D components have only 2 degrees of freedom. It is used to convert radial and tangential components of the current vector into the three coil currents.
Parameters: |
|
---|
Look up the fixed point sine value.
This looks up the sine of a value. The value is the index into the sine table, rather than a particular angular measurement. The sine table has 256 entries, so each index is 1.4 degrees.
A table of 256 entries is suitable for an encoder angle measured in 1024 steps, attached to a 4 pole motor. Each encoder step is 360/1024 = 0.35 physical degrees, but this is worth 4 times as many electrical degrees, or 1.4 electrical degrees.
The result is in fixed point 18.14 format.
Parameters: |
|
---|---|
Returns: | the 18.14 fixed point sine value |
Look up the fixed point cosine value.
This looks up the cosine of a value. The value is the index into the sine table, rather than a particular angular measurement.
Parameters: |
|
---|---|
Returns: | the 18.14 fixed point cosine value |
Run the watchdog timer server.
The watchdog timer needs a constant stream of pulses to prevent it from shutting down the motor. This is a thread server which implements the watchdog timer output.
The watchdog control port should have two bits attached to the watchdog circuitry. Bit zero will get a rising edge whenever the watchdog is to be reset, and bit one will have the pulse train.
Parameters: |
|
---|
Implement the high level Ethernet control server.
This control the motors based on commands from the ethernet/TCP stack
Parameters: |
|
---|
This is a thread which performs the higher level control for the CAN interface.
Use it in conjunction with the thread ‘canPhyRxTx’ from the module module_can.
Parameters: |
|
---|
The control structure for the LCD ports.
The display uses an I2C interface with an extra control signal to support selection between a data read/write and a control read/write. This extra signal is bit zero of the p_core1_shared member - which contains no other signals despite the name.
Structure Members:
i2c serial clock
i2c serial data
i2c chip select
Display data/control select.
Reverse the order of bytes in the array.
Parameters: |
|
---|
Convert an integer into a base 10 ASCII string.
Parameters: |
|
---|
Initialise the LCD device.
Parameters: |
|
---|
Write a byte to the LCD.
Parameters: |
|
---|
Clear the LCD.
Parameters: |
|
---|
Draw an image on the LCD.
Draw an image on the LCD. The image is assumed to cover the complete LCD. The size of the LCD is 128 wide by 32 high.
Parameters: |
|
---|
Write text to a row on the LCD.
Display a row of text. The LCD columns beyond the end of the string will be cleared.
Parameters: |
|
---|