This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: LP-AM243x + BissC

Part Number: LP-AM243
Other Parts Discussed in Thread: BP-AM2BLDCSERVO

Tool/software:

Hi,

I have AM243x-LP and trying to read Biss-C singleturn 26 bit encoder. I use the following sample code. "C:\ti\motor_control_sdk_am243x_09_02_00_09\examples\position_sense\bissc_diagnostic\single_channel\am243x-lp"

Menu options are as follows;

#define BISSC_CMD_ENC_LOOP_OVER_CYC (5)
#define BISSC_CMD_PERIODIC_TRIGGER (6)

When I use (5), I get the Angle value

When I use (6) 12500 / 3000 for cmp* values, the code stuck at "ret = bissc_get_pos(priv);" in "int32_t bissc_get_pos(struct bissc_priv *priv)" funtion. 

When I debug (5) and (6), I see very clear that (5) runs but (6) does not.

Regards,

Vedat

  • Hi

    What is the value of BiSS-C clock frequency which you have configured?

    Regards

    Dhaval

  • Hi Dhaval,

    It is 1 MHz ! according to "2 : Select clock frequency in MHz(1/2/5/8/10) " and cmp3/cmp0 does not work.

    Regards,

    Vedat

  • Hi 

    what's the single turn and multi turn resolution of the encoder you are using? 

    I see you are configuring IEP Count as 12500 which means you are trying to run BiSS encoder in 16 KHz Position cycle. You will have 62.5 us for one complete cycle. If your BiSS-C cycle time exceeds this value then continuous mode will fail. 

    Check the below thread on how to go about the calculation. 

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1446338/mcu-plus-sdk-am243x-bissc-encoder-interface-with-16khz-cycle/5558906?tisearch=e2e-sitesearch&keymatch=%25252525252520user%2525252525253A630978#5558906

    You can estimate the cycle time by 1*(total no of bits you are sending) us + 20 us( static timeout for bissc) - for BISS-C clock frequency at 1 MHz

    Alternatively you can run command 5, capture the clock and rx signal and check the cycle time using logic analyser. 

    You can also try configuring higher IEP count and check. 

    Regards 
    Arnav 

  • Hi Arnav,

    Thanks for your support.  At 8MHz my 21 bit position 26 bit (21 +crc +error bits)  singleturn encoder runs in contiuous mode (6).

    | Enter IEP cycle count(must be greater than BiSS cycle time including timeout period, in IEP cycles): 12500

    | Enter IEP trigger time(must be less than or equal to IEP cycle count, in IEP cycles): 2500

    |

    | press enter to stop the continuous mode

    Channel:0 - Enc1: Angle:11.122895241000, crc error count enc1:460438

      

     I have some further questions.

    I use “C:\ti\motor_control_sdk_am243x_09_02_00_09\examples\tidep_01032_dual_motor_drive\single_chip_servo\am243x-lp\system_freertos_nortos”

    I have one PMSM servo motor with BissC encoder ( described above) therefore I don’t use r5fss0-1. I don’t use Ethercat r5fss1-0.

    I use similar code of Jianyu Wang https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1410308/lp-am243-sddf-cycle-time-icssg0-pru0-affects-bissc-cycle-time-icssg0-pru1

    When I debug r5fss0-0, I see that “bissc_get_pos(priv);” reads Angle 0-360 degrees but with crc error count. But I use this function in gLoopCnt++ Loop not in “pruEncoderIrqHandler”. Does these crc errors effect the algorithm when I use it in “pruEncoderIrqHandler”.

     

    In “pruEncoderIrqHandler”.the encoder reading ( for endat and I use is for BissC)  is as follows;

    #if !defined(USE_PURE_OPEN_LOOP)&&!defined(USE_OPEN_LOOP_WITH_SDDF)

                /* Get the latest mechanical theta and multi-turn position from the encoder */

                if (localEnDatGetSingleMulti(&mechTheta, &multiTurn, 0) != 0)

                {

                    gEncErrCnt++;

                    return;

                }

                gPruEncoderIrqCnt_after++;

    #endif

    My “localEnDatGetSingleMulti " will be as follows;

    uint8_t localEnDatGetSingleMulti(float32_t * mechTheta){

        uint32_t pos;

        int result = 0;

        result = bissc_get_pos(priv);

        pos = priv->enc_pos_data[0].position[0];

        *mechTheta = (float32_t) pos / (float32_t) priv->step * 360.0;

        return 0;

    }

     

    I think that equation “(float32_t) pos / (float32_t) priv->step * 360.0;” converts position counts to Angle. Can I use “mechTheta = priv->enc_pos_data[0].angle[0];”?

     

    What are

    ///#define USE_PURE_OPEN_LOOP

    //#define USE_OPEN_LOOP_WITH_SDDF

     in "setting.h"

    I use

    #define  BUILDLEVEL             CLOSED_LOOP_SPEED

    I think that I must use “USE_OPEN_LOOP_WITH_SDDF”  to get position from the encoder

     Regards,

    Vedat

  • Hi

    When I debug r5fss0-0, I see that “bissc_get_pos(priv);” reads Angle 0-360 degrees but with crc error count. But I use this function in gLoopCnt++ Loop not in “pruEncoderIrqHandler”. Does these crc errors effect the algorithm when I use it in “pruEncoderIrqHandler”.

    Have you made any changes to modify the trigger time of BiSS-C position request?

    What are

    ///#define USE_PURE_OPEN_LOOP

    //#define USE_OPEN_LOOP_WITH_SDDF

     in "setting.h"

    This is used for testing with open loop without feedback. If these macros are defined, position feedback will not be enabled.

    Regards

    Dhaval

  • Hi Dhaval,

    I did not make any changes to modify the trigger time of BiSS-C position request. Should I do? If yes how?

    Is there a document where I can find information you explained about open loop macros. I use "SPRAD03 – MARCH 2022".

    In this document the "11.4 Step 3. Open Loop Iq Control (BUILDLEVEL == OPEN_LOOP_IQ_ID)" section describes how to check  'gSddfChOffsets' and 'gMechAngleOffset'. ıt is described as "Sigma Delta offsets should be somewhere in the range of -1000 to 1000.". My offsetts are around 123865000. I am using BP-AM2BLDCSERVO board and my J11,J13,J26 jumpers are 1-2 shortened for current sense and J17 is 1-2 shortened for SDFM clock. Something is wrong ...?

    Regards,

    Vedat

  • Vedat

    I did not make any changes to modify the trigger time of BiSS-C position request. Should I do? If yes how?

    You will have to make changes in following files potentially:

    1 endat_periodic_trigger.c
    • Review and update based on motor_control_sdk\examples\position_sense\bissc_diagnostic\bissc_periodic_trigger.c
    2 endat_periodic_trigger.h
    • Review and update based on motor_control_sdk\examples\position_sense\bissc_diagnostic\bissc_periodic_trigger.h
    3 example.syscfg
    • Remove ENDAT module instance and add BiSS-C instance (enable channels 0,2 with load share as per your setup)
    4 settings.h
    • Rename and update ENDAT_EVENT macro based on corresponding changes in change #1, #2 and #8
    5 single_chip_servo.c

    • Update the include paths for BiSS-C

      #include <position_sense/endat/include/endat_drv.h>
      #include <position_sense/endat/firmware/endat_master_bin.h>
      #include <position_sense/endat/firmware/endat_master_multi_bin.h>
      #include "endat_periodic_trigger.h"
      
      #if CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_SINGLE_PRU
      #include  <position_sense/endat/firmware/endat_master_multi_bin.h>
      #endif
      
      #if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU)
      #include <position_sense/endat/firmware/endat_master_multi_RTU_bin.h>
      #endif
      
      #if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU)
      #include <position_sense/endat/firmware/endat_master_multi_PRU_bin.h>
      #endif
      
      #if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU)
      #include <position_sense/endat/firmware/endat_master_multi_TXPRU_bin.h>
      #endif
      
      #if CONFIG_ENDAT0_MODE == ENDAT_MODE_SINGLE_CHANNEL_SINGLE_PRU
      #include <position_sense/endat/firmware/endat_master_bin.h>
      #endif

    6
    • Update the name of global variables and macros
    • Refer to examples\position_sense\bissc_diagnostic\bissc_diagnostic.c for changes
    7
    • Update function definitions and function calls
      • Replace endat_get_fw_version 
      • Replace endat_pruss_init
      • Review and add bissc_pruicss_init call instead of endat_pre_init (Remove endat_pre_init)
      • Replace endat_pruss_load_run_fw 
      • Remove endat specific code from init_encoder and replace it with code from bissc_main and other functions in examples\position_sense\bissc_diagnostic\bissc_diagnostic.c
      • Remove endat_calc_clock, endat_handle_prop_delay, endat_do_sanity_tst_delay, endat_init_clock
      • Update localEnDatGetSingleMulti function to read data from BiSS-C structure
    • Refer to examples\position_sense\bissc_diagnostic\bissc_diagnostic.c for changes
    8

    PRU Firmware

    source\position_sense\bissc\firmware\*

    • Changes to store data into TCM or another global memory directly, as per need

    In this document the "11.4 Step 3. Open Loop Iq Control (BUILDLEVEL == OPEN_LOOP_IQ_ID)" section describes how to check  'gSddfChOffsets' and 'gMechAngleOffset'. ıt is described as "Sigma Delta offsets should be somewhere in the range of -1000 to 1000.". My offsetts are around 123865000. I am using BP-AM2BLDCSERVO board and my J11,J13,J26 jumpers are 1-2 shortened for current sense and J17 is 1-2 shortened for SDFM clock. Something is wrong ...?

    What changes did you make for testing this? Are you connecting the current feedback pins as needed for ICSS SDFM?

    Regards

    Dhaval

  • Hi Dhaval,

    Thank you very much for detailed change procedure. I will follow these 8 steps.

    Dhaval said:

    What changeDhaval said:s did you make for testing this? Are you connecting the current feedback pins as needed for ICSS SDFM?

    In SPRAD03 – MARCH 2022" pdf document,  "11.4 Step 3. Open Loop Iq Control (BUILDLEVEL == OPEN_LOOP_IQ_ID)" section describes how to check  'gSddfChOffsets' and 'gMechAngleOffset'. I just checked the offsets after gSDDFOfsetComplete = TRUE and got float values around 123865000 which should be between -1000/1000 according to this document. When I run original endat code (although BissC encoder is connected) I got the following offsetts which are in correct range. 

    In my code RTUirq is running but ADC values are wrong. When endat code reads adc offsets correctly I supoose that my 3 motor phases are connected correctly. Is there a way to check the connection of  the current feedback pins as needed?

    I will follow your steps and I will inform you on Monday.

    Regards,

    Vedat