Hello Fabien,
thanks for the details.
The demo design simply measures the voltages seen at the CURx pins and displays them on the OLED.
For the demo design this is just some testing to see if anything happens at all

.
The demo design itself is not current controlled but uses the HALL signals of the motor to close the loop for BLDC commutation.
Furthermore, the demo design uses simple block commutation.
I suppose, you plan to use some kind of field oriented control (FOC) because you want to measure the currents.
Therefore you first need to change to PWM scheme. Block commutation is not optimal for FOC. Try using a sine based PWM (SPWM) or space vector modulation (SVPWM).
This is something you have to do on your own...VHDL

.
Anyway, let's come to your questions regarding current measurement:
On the TRINAMIC motor control kit, the CURx pins of the TMC603A show a voltage from which the current needs to be calculated.
The configuration of the TMC603A on the TRINAMIC board is to use shunt resistor based measurement! This is hard-wired in the board layout.
So you need to take the other formular from the manual of the TMC603A: Ishunt = Vdrop / Rshunt.
The voltage level you actually see on the CURx pins is the amplified voltage drop over the shunt resistors (R010 --> 10 milliOhms) that are on the TRINAMIC board.
Furthermore,the voltage level is centered to 1/3 of VCC at zero current.
So as VCC is approx. 5V, the voltage level at motor standstill is approx. 1.6V = zero current.
When no load is applied to the motor, you can see no huge change here as the required current is low.
Anyway when using a scope you can see the current of the three phases somewhere around 1.6V. You should try visualizing it using some oscilloscpe.
The required voltage is the DIFFERENCE from the zero-current voltage measured with the ADC and the actual voltage

.
In the demo design, the SAMPLEx pins of the TMC603A are set to 1, which means "sampling is self-timed" for the TMC603A (see section 5.3.1 in our datasheet).
Further, the SENSE_HI pin of the TMC603A is set to 1, meaning an internal amplification of approx. 20.8 (please also verify with the datasheet of the TRINAMIC IC, section 5.3 on the current measuremant and table on page 37 regarding typical parameters for the current measuremnt block).
In self-timed mode, the value of the CURx pins is valid approximately 6us after a rising edge on the low side bridge chopper signals (BLx). Please see the diagram in the datasheet.
After these 6us, you can start sampling with the ACE engine to get the actual voltage on one of the respective CURx pin.
In one of our designs we use the following C-code to calculate the current from one CURx pin:
current_x_mA = (((ZERO_CURRENT_mV - ACE_convert_to_mV (CURx_603, ACE_get_ppe_sample( CURx_603 ))) / RSENSE) / AMPLIFICATION);
ZERO_CURRENT_mV --> voltage on the CURx pin at zero current, approximately 1610mV
CURx_603 --> ACE handle of the ADC channel
RSENSE --> const float RSENSE = 0.01; // [Ohm]
AMPLIFICATION --> float AMPLIFICATION = 20.8; // actual internal amplification, SENSE_HI = 1 --> 20.8, SENSE_HI = 0 --> 4.5
When measuring outside a high pulse of the BLx signal, the voltage on the CURx pin is swinging, may drift and does not show the correct value.
For a more fine grained measurement, use the function of the SAMPLEx signal. When set to zero, the CURx signals are set into a hold stage showing a stable voltage level.
Now you have some more time to measure and even use some filter on the CURx signal. But you need to take care as the voltage levels of the CURx pins may drift during hold.
For best results, set SAMPLEx to zero right in the middle of the BLx high-pulse and then measure the current (voltage) during hold.
After measurement switch SAMPLEx back to '1'.

To conclude...
...in the demo design, the CURx shown in the OLED is just a very basic measurement of the voltage at these pins and does not reflect the current.
...when transforming the voltage into mA or A, you need to calculate the difference between 1/3 VCC and the voltage measured at the pins together with the sense resistor and the internal amplification.
...you need to measure at the right point of time. Maybe use SAMPLx pin functionality for sample & hold.
Maybe this does not answer already all questions but should help you.
If you have more questions do not hesitate to contact me, also directly by email (
kubisch@trinamic.com).
Regards - Stephan
Tip: When applying load to the motor (you can try to hold the motor shaft a little bit with your fingers), you will see a voltage change even on the OLED.This is because now more current is required and this can even be seen with this simple voltage measurement in the demo design. You should also try to use the option "6" in the terminal menu of the demo design, which manually toggles the SAMPLEx signal.