diff --git a/docs_src/docs/api_guide/device/am243x/release_notes_09_00_00.md b/docs_src/docs/api_guide/device/am243x/release_notes_09_00_00.md index b362b0f..ba5ff2f 100644 --- a/docs_src/docs/api_guide/device/am243x/release_notes_09_00_00.md +++ b/docs_src/docs/api_guide/device/am243x/release_notes_09_00_00.md @@ -369,10 +369,21 @@ earlier SDKs. Additional Remarks + Position Sense EnDat + \ref endat_init + Added api parameter + void* pruss_iep + + + Position Sense EnDat + Structure: endat_priv + Added variables: pruss_iep, cmp3, cmp5 and cmp6 - - + + + Position Sense EnDat + Structure: cmd_supplement + Added variables: cmp3, cmp5 and cmp6 - diff --git a/docs_src/docs/api_guide/examples/endat_example.md b/docs_src/docs/api_guide/examples/endat_example.md index a75b8f7..42829c9 100644 --- a/docs_src/docs/api_guide/examples/endat_example.md +++ b/docs_src/docs/api_guide/examples/endat_example.md @@ -62,7 +62,7 @@ Following section describes the Example implementation of EnDat on ARM(R5F). Folder/Files Description - ${SDK_INSTALL_PATH}/examples/motor_control/endat_diagnostic + ${SDK_INSTALL_PATH}/examples/position_sense/endat_diagnostic endat_diagnostic.c EnDAT diagnostic application @@ -86,7 +86,7 @@ Following section describes the Example implementation of EnDat on ARM(R5F). ---------------|----------- CPU + OS | r5fss0-0 freertos ICSSG | ICSSG0 - PRU | PRU1 + PRU | PRU1, TXPRU1 and RTUPRU1 Toolchain | ti-arm-clang Board | @VAR_BOARD_NAME_LOWER Example folder | examples/motorcontrol/endat_example @@ -99,7 +99,7 @@ Following section describes the Example implementation of EnDat on ARM(R5F). ---------------|----------- CPU + OS | r5fss0-0 freertos ICSSG | ICSSG0 - PRU | PRU1 + PRU | PRU1, TXPRU1 and RTUPRU1 Toolchain | ti-arm-clang Board | @VAR_BOARD_NAME_LOWER, @VAR_LP_BOARD_NAME_LOWER Example folder | examples/motorcontrol/endat_example @@ -120,8 +120,8 @@ Other than the basic EVM setup mentioned in \htmllink{@VAR_MCU_SDK_DOCS_PATH/EVM ### Hardware Prerequisities for Booster Pack - EnDat encoder -- AM243x-LP board -- BP-AM2BLDCSERVO +- AM243x-LP board +- BP-AM2BLDCSERVO, https://www.ti.com/tool/BP-AM2BLDCSERVO \endcond ## Hardware Setup @@ -222,389 +222,571 @@ Shown below is a sample output when the application is run: + - + + - + - + + - - + - - - - + + - + + - - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - + - + + - + - - - + + - + + + + - - + + + + + + + - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - - - + - + + - - - + - - - + + + + - + + + + + + + + + + + + + + + + + - + - - - + + - - + - - - + + - + + + + + + + + + + + + + + - - - + + - - + - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - + - - - - + + - + - + - - + - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + + - - + - + + - - + + + - - + - + + - - - + + - - - + + - - + - - - + + - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + +
S.No Test detail Steps Pass/fail crieteria
To check position value1.To check position value 1. Enter 1 to select "Encoder send position values"Crc success CRC success
To receive encoder's operating parameters(error messege)2.To receive encoder's operating parameters (Error Message) 1. Enter 2 to select "Selection of memory area"
2. Enter "B9" in MRS code to select "Operating parameters"Crc success CRC success
3. Enter 4 to select "Encoder to send parameter"
4. Enter 0 in "parameter address" for selecting "Error message"Crc success 4. Enter 00 in "parameter address" for selecting "Error message"CRC success
To receive encoder's manufacture parameters for Endat 2.23.To receive encoder's operating parameters (Warning message) 1. Enter 2 to select "Selection of memory area"
2. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"Crc success 2. Enter "B9" in MRS code to select "Operating parameters"CRC success
3. Enter 4 to select "Encoder to send parameter"Crc success
4. Enter 0 in "parameter address" for selecting "Status of additional info"Crc success
To set values to encoder's operating parameters (error message)4. Enter 01 in "parameter address" for selecting "Error message"CRC success
4.To receive encoder's manufacture parameters for Endat 2.21. Enter 2 to select "Selection of memory area"
2. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"CRC success
3. Enter 4 to select "Encoder to send parameter"CRC success
4. Enter 0 in "parameter address" for selecting "Status of additional info 1"CRC success
5.To set values to encoder's operating parameters (Clear error message) 1. Enter 2 to select "Selection of memory area"
2. Enter "B9" in MRS code to select "Operating parameters"Crc success CRC success
3. Enter 3 to select "Encoder to receive parameter"
4. Enter 0 in "parameter address" for selecting "Error message"
5. Enter 0 in "parameter value" for seting value in " Error message"Crc success CRC success
To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info)6.To set values to encoder's operating parameters (Clear warning message) 1. Enter 2 to select "Selection of memory area"
2. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"Crc success 2. Enter "B9" in MRS code to select "Operating parameters"CRC success
3. Enter 3 to select "Encoder to receive parameter"
4. Enter 01 in "parameter address" for selecting "Error message"
4. Enter 0 in "parameter address" for selecting "Status of additional info"5. Enter 0 in "parameter value" for seting value in " Error message"CRC success
7.To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info)1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
5. Enter 0 in "parameter value" for seting value in " Status of additional info"Crc success 2. Enter "45" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"CRC success
To reset encoder3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"CRC success
4. Enter "BD" in MRS code to select "Memory parameter (LSB)" of Additional Information 1CRC success
5. Enter 10 to select "Encoder send position values + Additional Information(s) and receive parameter"
6. Enter 0 in "parameter address" for selecting "Status of additional info"
7. Enter 1235 (or any 2 byte value) in "parameter value" for seting value in " Status of additional info"CRC success
8. Enter 8 to select "Encoder send position values + Additional Information(s)"
Note: Write is not permenant. When read again using Command 11, encoder will return the default value
Values followed by 0x45 represents last byte of the data received by encoder
Crc success
8.To reset encoder 1. Enter 5 to select "Encoder receive reset"Crc success CRC success
To receive test values from encoder with port address "0"9.To receive test values from encoder with port address "0" 1. Enter 7 to select "Encoder receive test command"
2. Enter 0 in "enter port address"
3. Enter 6 to select "Encoder send test values"Crc success CRC success
To receive test values from encoder with port address "E" 10.To receive test values from encoder with port address "E" 1. Enter 7 to select "Encoder receive test command"
2. Enter "E" in "enter port address"
3. Enter 6 to select "Encoder send test values"Crc success CRC success
To check position value with aditional info.1. Enter 8 to select "Encoder send position values + AI(s)"Crc success 11.To check position value with aditional info.1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"CRC success
To receive encoder's operating parameters(error messege) + 2. Enter "47" in MRS code to select "Acknowledge MRS code" of Additional Information 1CRC success
3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
4. Enter "56" in MRS code to select "Asynchronous Position value word 1 LSB" of Additional Information 2CRC success
5. Enter 8 to select "Encoder send position values + Additional Information(s)"CRC success
12.To receive encoder's operating parameters(error messege) +receive position value with additional info 1. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "B9" in MRS code to select "Operating parameters"Crc success 2. Enter "45" in MRS code to select "Memory parameter (LSB)" of Additional Information 1CRC success
3. Enter 11 to select "Encoder send position values + AI(s) and send parameter"3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
4. Enter 0 in "parameter address" for selecting "Error message"Crc success4. Enter "B9" in MRS code to select "Operating parameters"CRC success
To receive encoder's manufacture parameters + 5. Enter 11 to select "Encoder send position values + Additional Information(s) and send parameter"
6. Enter 0 in "parameter address" for selecting "Error message"CRC success
7. Enter 8 to select "Encoder send position values + Additional Information(s)"CRC success
13.To receive encoder's manufacture parameters for Endat 2.2 +receive position value with additional info - 1. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"Crc success 2. Enter "45" in MRS code to select "Memory parameter (LSB)" of Additional Information 1CRC success
3. Enter 11 to select "Encoder send position values + AI(s) and send parameter"3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
4. Enter 0 in "parameter address" for selecting "Status of additional info"Crc success4. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"CRC success
To set values to encoder's operating parameters (error message) + 5. Enter 11 to select "Encoder send position values + Additional Information(s) and send parameter"
6. Enter 0 in "parameter address" for selecting "Status of additional info 1"
7. Enter 8 to select "Encoder send position values + Additional Information(s)"CRC success
14.To acknowledge MRS code for Endat 2.2 + 1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "47" in MRS code to select "Acknowledge MRS code" of Additional Information 1CRC success
3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area
4. Enter "BD" or any other valid MRS code CRC success
5. Enter 8 to select "Encoder send position values + Additional Information(s)"Additional Information 1:0x47bd00
    (for MRS code = BD)
15.To set values to encoder's operating parameters (error message) +receive position value with additional info - 1. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "B9" in MRS code to select "Operating parameters"Crc success CRC success
3. Enter 10 to select "Encoder send position values + AI(s) and receive parameter"3. Enter 10 to select "Encoder send position values + Additional Information(s) and receive parameter"
4. Enter 0 in "parameter address" for selecting "Error message"
5. Enter 0 in "parameter value" for seting value in " Error message"Crc success5. Enter 0 in "parameter value" for seting value in "Error message"CRC success
To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info) + 16.To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info) +receive position value with additional info 1. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2"Crc success CRC success
3. Enter 10 to select "Encoder send position values + AI(s) and receive parameter"3. Enter 10 to select "Encoder send position values + Additional Information(s) and receive parameter"
4. Enter 0 in "parameter address" for selecting "Status of additional info"
5. Enter 0 in "parameter value" for seting value in " Status of additional info"Crc successCRC success
To reset encoder +receive position value with additional info1. Enter 12 to select "Encoder send position values + AI(s) and receive error reset"Crc success
1. Enter 14 to select "Encoder receive communication command"Crc success
2. Enter ______in "enter encoder address" Crc success
3. Enter _____ in "instruction hex value"Crc success
1. Enter 14 to select "Encoder receive communication command"Crc success
2. Enter ______in "enter encoder address" Crc success
3. Enter _____ in "instruction hex value"Crc success
Configure Clock 1. Enter 100 to select "configure clock"Crc success(Tested up to 8MHz)
2. Enter ___ for clock frequency(in Hz)17.To receive encoder's OEM (Original Equipment Manufacturer) data 1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
Simulate motor control 2.1 position loop2. Enter "45" in MRS code to select "Memory parameter (LSB)" of Additional Information 1CRC success
3. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
4. Enter A9 (or AB or AD) in MRS code to select the OEM memoryCRC success
5. Enter 11 to select "Encoder send position values + Additional Information(s) and send parameter"
6. Enter 40 in "parameter address"
7. Enter 8 to select "Encoder send position values + Additional Information(s)"CRC success
18.To set values in OEM memory area 1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "A9" in MRS code to select "Operating parameters"CRC success
3. Enter 10 to select "Encoder send position values + Additional Information(s) and receive parameter"
4. Enter 40 in "parameter address"
5. Enter E9 in "parameter value"CRC success
19.To reset encoder +receive position value with additional info1. Enter 12 to select "Encoder send position values + Additional Information(s) and receive error reset"CRC success
1. Enter 14 to select "Encoder receive communication command"CRC success
2. Enter ______in "enter encoder address" CRC success
3. Enter _____ in "instruction hex value"CRC success
1. Enter 14 to select "Encoder receive communication command"CRC success
2. Enter ______in "enter encoder address" CRC success
3. Enter _____ in "instruction hex value"CRC success
20.Configure Clock 1. Enter 100 to select "configure clock"
2. Enter ___ for clock frequency(in Hz)CRC success(Tested up to 8MHz)
21.Simulate motor control 2.1 position loop 1. Enter 101 to select "Simulate motor control 2.1 position loop"
2. Enter 10000 to select "clock frequency"
3. Rotate the rotor of motor and see the changes in Position value on UARTPosition Values are changing when rotor moves Position Values are changing when rotor moves
Toggle raw data display22.Toggle raw data display 1. Enter 102 to select "Toggle raw data display"
2. Enter 1 to select "Encoder send position value"raw data can be displayed raw data can be displayed
Configure TST delay23.Configure TST delay
Start continous mode1. Enter 104 to select "Start continous mode"24.Start continuous mode1. Enter 104 to select "Start continuous mode"
2. Rotate the rotor of motor and see the changes in Position value on UARTPosition Values are changing when rotor moves Position Values are changing when rotor moves
Configure rx arm counter25.Configure rx arm counter 1. Enter 105 to select "Configure rx arm counter"
2. Enter 0 to select channel 0(only for multi channel configuration)
3. Enter ___ to "select time in ns"
configure rx clock disable time26.configure rx clock disable time 1. Enter 106 to select "configure rx clock disable time"
2. Enter 0 to select channel 0(only for multi channel configuration)
3. Enter ___ to "select time in ns"
Simulate motor control 2.2 position loop(safety)27.Simulate motor control 2.2 position loop(safety) 1. Enter 107 to select "Simulate motor control 2.2 position loop"
3. Enter 10000 to select "clock frequency"2. Enter 10000 to select "clock frequency"
4. Rotate the rotor of motor and see the changes in Position value on UARTPosition Values are changing when rotor moves 3. Rotate the rotor of motor and see the changes in Position value on UARTPosition Values are changing when rotor moves
Configure propogation delay(td)28.Configure propogation delay(td) 1. Enter 108 to select configure propagation delay
2. Enter 0 to select channel 0(only for multi channel configuration)
To read Recovery Time1. Enter 8 to select "Encoder send position values + AI(s)" Crc Success 29.Configure Recovery time (tr) using EnDat 2.2 mode transmission1. Enter 9 to select "Encoder send position values + Additional Information(s) and Selection of memory area"
2. Enter "B9" in MRS code to select "Operating parameters"
3. Enter 10 to select "Encoder send position values + Additional Information(s) and receive parameter"
4. Enter 03 in "parameter address" for selecting "Initializing the functions"
5. Enter 01 in "parameter value" for selecting low recovery time
               or
   Enter 02 in "parameter value" for selecting high recovery time
CRC success
30.To read Recovery Time1. Enter 8 to select "Encoder send position values + Additional Information(s)" CRC Success
2. Enter 110 for read recovery time from DMEM Recovery Time is set to 1.25 us <= RT <= 3.75us or 10 us <= RT <= 30 usRecovery Time is set to 1.25 us <= RT <= 3.75us or 10 us <= RT <= 30 us
31.To test periodic continuous mode1. Enter 200 to enable periodic mode
2. Enter 5000 (in ns) for position read time Position Values are changing when rotor moves
32.Long term test1. Enter 111 to enable Long time continuous mode
2. press enter to stop the long term testThe result shows the number of position command sent and the number of CRC failures received
\ No newline at end of file diff --git a/docs_src/docs/api_guide/examples/hdsl_example.md b/docs_src/docs/api_guide/examples/hdsl_example.md index b570a9e..43b1c01 100644 --- a/docs_src/docs/api_guide/examples/hdsl_example.md +++ b/docs_src/docs/api_guide/examples/hdsl_example.md @@ -93,7 +93,7 @@ Other than the basic EVM setup mentioned in \htmllink{@VAR_MCU_SDK_DOCS_PATH/EVM - HDSL encoder - AM243x-LP board -- BP-AM2BLDCSERVO +- BP-AM2BLDCSERVO, https://www.ti.com/tool/BP-AM2BLDCSERVO \endcond diff --git a/docs_src/docs/api_guide/examples/tamagawa_example.md b/docs_src/docs/api_guide/examples/tamagawa_example.md index 764a774..32d31fd 100644 --- a/docs_src/docs/api_guide/examples/tamagawa_example.md +++ b/docs_src/docs/api_guide/examples/tamagawa_example.md @@ -95,7 +95,7 @@ Other than the basic EVM setup mentioned in \htmllink{@VAR_MCU_SDK_DOCS_PATH/EVM - Tamagawa encoder - AM243x-LP board -- BP-AM2BLDCSERVO +- BP-AM2BLDCSERVO, https://www.ti.com/tool/BP-AM2BLDCSERVO \endcond diff --git a/docs_src/docs/api_guide/images/position_sense/EnDAT_Initialization_UART_PRINT.png b/docs_src/docs/api_guide/images/position_sense/EnDAT_Initialization_UART_PRINT.png index cd5a43d..25a0063 100644 Binary files a/docs_src/docs/api_guide/images/position_sense/EnDAT_Initialization_UART_PRINT.png and b/docs_src/docs/api_guide/images/position_sense/EnDAT_Initialization_UART_PRINT.png differ diff --git a/examples/position_sense/endat_diagnostic/endat_diagnostic.c b/examples/position_sense/endat_diagnostic/endat_diagnostic.c index eec4f16..59fe979 100644 --- a/examples/position_sense/endat_diagnostic/endat_diagnostic.c +++ b/examples/position_sense/endat_diagnostic/endat_diagnostic.c @@ -66,15 +66,15 @@ #include #endif -#if (CONFIG_ENDAT0_CHANNEL0) && (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) +#if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) #include #endif -#if (CONFIG_ENDAT0_CHANNEL1) && (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) +#if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) #include #endif -#if (CONFIG_ENDAT0_CHANNEL2) && (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) +#if (CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU) #include #endif @@ -109,11 +109,11 @@ TaskP_Object gTaskObject; #define VALID_PERIODIC_CMD(x) ((x) == 200) #define VALID_HOST_CMD(x) ((x == 100) || ((x) == 101) || ((x) == 102) || ((x) == 103) || ((x) == 104) || ((x) == 105) || \ - ((x) == 106) || ((x) == 107) || ((x) == 108) || ((x) == 109) || ((x) == 110)) + ((x) == 106) || ((x) == 107) || ((x) == 108) || ((x) == 109) || ((x) == 110) || ((x) == 111)) #define HAVE_COMMAND_SUPPLEMENT(x) (((x) == 2) || ((x) == 3) || ((x) == 4) || ((x) == 7) || \ ((x) == 9) || ((x) == 10) || ((x) == 11) || ((x) == 13) || ((x) == 14) || \ - ((x) == 100) || ((x) == 101) || ((x)== 103) || ((x) == 105) || ((x) == 106) || ((x) == 107) || ((x) == 108) || ((x) == 109)||((x) == 200)) + ((x) == 100) || ((x) == 101) || ((x)== 103) || ((x) == 105) || ((x) == 106) || ((x) == 107) || ((x) == 108) || ((x) == 109) || ((x) == 200)) #define ENDAT_INPUT_CLOCK_UART_FREQUENCY 192000000 /* use uart clock only to start with */ @@ -206,7 +206,7 @@ uint32_t endat_pruss_load_run_fw(struct endat_priv *priv) #if CONFIG_ENDAT0_MODE == ENDAT_MODE_MULTI_CHANNEL_MULTI_PRU /*enable loadshare mode*/ -#if(CONFIG_ENDAT0_CHANNEL0) + status = PRUICSS_disableCore(gPruIcssXHandle, PRUICSS_RTUPRUx); DebugP_assert(SystemP_SUCCESS == status); @@ -219,9 +219,6 @@ uint32_t endat_pruss_load_run_fw(struct endat_priv *priv) status = PRUICSS_enableCore(gPruIcssXHandle, PRUICSS_RTUPRUx); DebugP_assert(SystemP_SUCCESS == status); -#endif - -#if(CONFIG_ENDAT0_CHANNEL1) status=PRUICSS_disableCore(gPruIcssXHandle, PRUICSS_PRUx ); DebugP_assert(SystemP_SUCCESS == status); @@ -234,9 +231,6 @@ uint32_t endat_pruss_load_run_fw(struct endat_priv *priv) status = PRUICSS_enableCore(gPruIcssXHandle, PRUICSS_PRUx); DebugP_assert(SystemP_SUCCESS == status); -#endif - -#if(CONFIG_ENDAT0_CHANNEL2) status = PRUICSS_disableCore(gPruIcssXHandle, PRUICSS_TXPRUx); DebugP_assert(SystemP_SUCCESS == status); @@ -249,7 +243,7 @@ uint32_t endat_pruss_load_run_fw(struct endat_priv *priv) status = PRUICSS_enableCore(gPruIcssXHandle, PRUICSS_TXPRUx); DebugP_assert(SystemP_SUCCESS == status); -#endif + status=endat_wait_initialization(priv, WAIT_5_SECOND, gEndat_multi_ch_mask); @@ -358,8 +352,9 @@ static void endat_print_menu(void) DebugP_log("\r|109: Configure wire delay |\n"); } - DebugP_log("\r|110: Recovery Time (RT) |\n"); - DebugP_log("\r|200: Start periodic continuous mode |\n"); + DebugP_log("\r|110: Recovery Time (RT) |\n"); + DebugP_log("\r|111: Simulate motor control 2.1 position loop for long time |\n"); + DebugP_log("\r|200: Start periodic continuous mode |\n"); DebugP_log("\r|------------------------------------------------------------------------------|\n\r|\n"); DebugP_log("\r| enter value: "); @@ -861,7 +856,6 @@ static int32_t endat_get_command_supplement(int32_t cmd, } break; - case 200: if(gEndat_is_load_share_mode) @@ -1954,6 +1948,79 @@ static void endat_process_host_command(int32_t cmd, } } + else if(cmd == 111) + { + DebugP_log("\r|press enter to stop the long time continuous mode\n|"); + if(endat_loop_task_create() != SystemP_SUCCESS) + { + DebugP_log("\r| ERROR: OS not allowing position loop as related Task creation failed\n|\n|\n"); + DebugP_log("\rTask_create() failed!\n"); + return; + } + + endat_position_loop_status = ENDAT_POSITION_LOOP_START; + + uint64_t poaition_read = 0; + /*clear CRC error count */ + memset(gEndat_mtrctrl_crc_err, 0, 3); + while(1) + { + if(endat_position_loop_status == ENDAT_POSITION_LOOP_STOP) + { + + if(gEndat_is_multi_ch || gEndat_is_load_share_mode) + { + int32_t j; + + for(j = 0; j < 3; j++) + { + if(gEndat_multi_ch_mask & 1 << j) + { + DebugP_log("\r -------Channel %u ------\n", j); + DebugP_log("\r position command sent = %u \n", poaition_read); + DebugP_log("\r CRC failures encountered = %u \n", gEndat_mtrctrl_crc_err[j]); + DebugP_log(" "); + DebugP_log("\r"); + } + } + } + else + { + DebugP_log("\r position command sent = %u \n", poaition_read); + DebugP_log("\r CRC failures encountered = %u \n", gEndat_mtrctrl_crc_err[0]); + DebugP_log(" "); + DebugP_log("\r"); + } + + return; + } + else + { + poaition_read++; + if(gEndat_is_multi_ch || gEndat_is_load_share_mode) + { + int32_t j; + + for(j = 0; j < 3; j++) + { + if(gEndat_multi_ch_mask & 1 << j) + { + endat_multi_channel_set_cur(priv, j); + endat_process_position_command(j); + } + } + } + else + { + endat_process_position_command(0); + } + + /* increase sleep value if glitches in display to be prevented (and would result in slower position display freq) */ + ClockP_usleep(500); + + } + } + } else { DebugP_log("\r| ERROR: non host command being requested to be handled as host command\n|\n|\n"); diff --git a/source/position_sense/endat/driver/endat_drv.c b/source/position_sense/endat/driver/endat_drv.c index 3796742..d37536b 100644 --- a/source/position_sense/endat/driver/endat_drv.c +++ b/source/position_sense/endat/driver/endat_drv.c @@ -1943,6 +1943,25 @@ uint8_t endat_multi_channel_detected(struct endat_priv *priv) void endat_multi_channel_set_cur(struct endat_priv *priv, int32_t ch) { priv->channel = ch; + if(priv->load_share) + { + if(priv->channel == 0) + { + priv->pos_res = priv->pos_rx_bits_21_RTUPRU - (ENDAT_NUM_BITS_POSITION_CRC + ENDAT_NUM_BITS_F1); + } + else if(priv->channel == 1) + { + priv->pos_res = priv->pos_rx_bits_21_PRU - (ENDAT_NUM_BITS_POSITION_CRC + ENDAT_NUM_BITS_F1); + } + else + { + priv->pos_res = priv->pos_rx_bits_21_TXPRU - (ENDAT_NUM_BITS_POSITION_CRC + ENDAT_NUM_BITS_F1); + } + } + else + { + priv->pos_res = priv->pos_rx_bits_21_RTUPRU - (ENDAT_NUM_BITS_POSITION_CRC + ENDAT_NUM_BITS_F1); + } } int32_t endat_wait_initialization(struct endat_priv *priv, uint32_t timeout, uint8_t mask)