Skip to content

Oscilloscope


Oscilloscope

dev_motor_controller features on board oscilloscope functionality that is useful for inspecting the internal state at rates up to the main controller frequency. An example use of the oscilloscope is inspecting a step response of a current controller.

Oscilloscope features are:

  • Configurable sample rate.
  • Four source configurable channels, each with a depth of 1792 float32 values.
  • Rising and falling edge triggers with configurable source.

Oscilloscope Commands

Command Type Required Description
oscilloscope_sample_rate_hz uint32 Required Set the sampling frequency of the oscilloscope.
The oscilloscope frequency must be an even divisor of the current controller frequency.
oscilloscope_trigger_source enum Required Sets the trigger source signal.
See Oscilloscope Sources for a list of trigger sources.
oscilloscope_trigger_config enum Optional Sets the trigger configuration.
See Oscilloscope Trigger Configuration for a list of trigger configurations.
oscilloscope_trigger_level float32 Required Sets the level for the trigger.
Once the trigger source passes this value the oscilloscope will sample until the channel arrays are full.
oscilloscope_trigger_buffer_position uint32 Optional Sets the position in the buffer where sampling commences.
Valid values are between 0 and 1792.
A parameter error will be returned for values larger than 1792.
See Trigger Buffer Position for more details.
oscilloscope_channel_0_source enum Optional Sets the channel 0 source signal.
See Oscilloscope Sources for a list of sources.
oscilloscope_channel_0 float32 Optional Contains the channel 0 sampled data.
Total length is 1792 float32 values. All values must be read out.
oscilloscope_channel_1_source enum Optional Sets the channel 1 source signal.
See Oscilloscope Sources for a list of sources.
oscilloscope_channel_1 float32 Optional Contains the channel 1 sampled data.
Total length is 1792 float32 values. All values must be read out.
oscilloscope_channel_2_source enum Optional Sets the channel 2 source signal.
See Oscilloscope Sources for a list of sources.
oscilloscope_channel_2 float32 Optional Contains the channel 2 sampled data.
Total length is 1792 float32 values. All values must be read out.
oscilloscope_channel_3_source enum Optional Sets the channel 3 source signal.
See Oscilloscope Sources for a list of sources.
oscilloscope_channel_3 float32 Optional Contains the channel 3 sampled data.
Total length is 1792 float32 values. All values must be read out.
oscilloscope_force_start command Optional The oscilloscope will immediately start sampling at the completion of this command, regardless of trigger configuration.
oscilloscope_stop command Optional The oscilloscope will immediately stop sampling or waiting for the trigger and return to the stopped condition.
oscilloscope_wait_trigger command Optional The oscilloscope will start sampling once the trigger conditions are met.
oscilloscope_is_done bool Optional Returns true if the oscilloscope is finished sampling or off and false if the oscilloscope is waiting for the trigger or sampling.

Oscilloscope Trigger Configuration

Trigger configuration Description
osc_trigger_rising The oscilloscope will start sampling once the trigger source signal goes above the trigger level.
osc_trigger_falling The oscilloscope will start sampling once the trigger source signal goes below the trigger level.

Oscilloscope Sources

Oscilloscope Source Description
mc_osc_sense_i_a Measured phase current (A). Phase A.
mc_osc_sense_i_b Measured phase current (A). Phase B.
mc_osc_sense_i_c Measured phase current (A). Phase C.
mc_osc_foc_i_al Measured motor current (A). Al axis in AlBe frame.
mc_osc_foc_i_be Measured motor current (A). Be axis in AlBe frame.
mc_osc_foc_i_d Measured motor current (A). D axis in DQ frame.
mc_osc_foc_i_q Measured motor current (A). Q axis in DQ frame.
mc_osc_foc_i_d_cmd Current command (A). D axis in DQ frame.
mc_osc_foc_i_q_cmd Current command (A). Q axis in DQ frame.
mc_osc_foc_i_d_cmd_ff Current command (A) with any feedforward terms present. D axis in DQ frame.
mc_osc_foc_i_q_cmd_ff Current command (A) with any feedforward terms present. Q axis in DQ frame.
mc_osc_foc_v_d_cmd Voltage command (V) as output from current controller. D axis in DQ frame.
mc_osc_foc_v_q_cmd Voltage command (V) as output from current controller. Q axis in DQ frame.
mc_osc_foc_v_d_mod_cmd Modulated voltage command (normalised to DC bus voltage). D axis in DQ frame.
mc_osc_foc_v_q_mod_cmd Modulated voltage command (normalised to DC bus voltage). Q axis in DQ frame.
mc_osc_foc_v_al_mod_cmd Modulated voltage command (normalised to DC bus voltage). Al axis in AlBe frame.
mc_osc_foc_v_be_mod_cmd Modulated voltage command (normalised to DC bus voltage). Be axis in AlBe frame.
mc_osc_foc_duty_a_cmd Duty cycles as output to PWM unit. Phase A.
mc_osc_foc_duty_b_cmd Duty cycles as output to PWM unit. Phase B.
mc_osc_foc_duty_c_cmd Duty cycles as output to PWM unit. Phase C.
mc_osc_sense_v_a Measured phase voltage (V). Phase A.
mc_osc_sense_v_b Measured phase voltage (V). Phase B.
mc_osc_sense_v_c Measured phase voltage (V). Phase C.
mc_osc_foc_v_al Measured motor voltage (V). Al axis in AlBe frame.
mc_osc_foc_v_be Measured motor voltage (V). Be axis in AlBe frame.
mc_osc_foc_v_d Measured motor voltage (V). D axis in DQ frame.
mc_osc_foc_v_q Measured motor voltage (V). Q axis in DQ frame.
mc_osc_rotor_th_m Rotor mechanical position (Rad).
mc_osc_rotor_th_e Rotor electrical position (Rad).
mc_osc_rotor_th_internal_m Rotor mechanical position (Rad). Direct from encoder, no compensation applied.
mc_osc_rotor_w_m Rotor mechanical speed (Rad/S).
mc_osc_sense_vdc Measured DC bus voltage (V).
mc_osc_i_mot Computed motor current (A).
mc_osc_i_bus Computed bus current (A).

Trigger Buffer Position

The oscilloscope_trigger_buffer_position parameter allows placing the trigger point at any point within the sampling buffer. This feature is useful for examining signals that may occur around the trigger event, rather than immediately after the trigger event.

As an example, if oscilloscope_trigger_buffer_position is set to 896 (half the sample buffer length) then the trigger event will appear at the midpoint of the sample buffer, and the user will see half the signal before the trigger event and half after.