am243x/am64x: SDFM: Enable continuous mode

- Add support for continuous mode

Fixes: PINDSW-7112

Signed-off-by: Achala Ram <a-ram@ti.com>
This commit is contained in:
Achala Ram 2023-11-23 14:24:11 +05:30
parent b35879bd82
commit 3c5cc57d30
6 changed files with 86 additions and 4 deletions

View File

@ -305,6 +305,11 @@ uint64_t SDFM_getFirmwareVersion(sdfm_handle h_sdfm)
{
return h_sdfm->p_sdfm_interface->firmwareVersion;
}
/*Enable free run NC */
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm)
{
h_sdfm->p_sdfm_interface->sdfm_cfg_trigger.en_continuous_mode = 1;
}
/*FD block confiuration */
void SDFM_configFastDetect(sdfm_handle h_sdfm, uint8_t ch, uint8_t *fdParms)
{

View File

@ -196,7 +196,8 @@
/*Sample timing offset*/
#define SDFM_CFG_EN_DOUBLE_UPDATE ( 0xE8 )
#define SDFM_CFG_EN_CONT_NC_MODE ( 0xE8 )
#define SDFM_CFG_EN_DOUBLE_UPDATE ( 0xEA )
#define FW_REG_SDFM_CFG_FIRST_TRIG_SAMPLE_TIME ( 0xEC )
#define FW_REG_SDFM_CFG_SECOND_TRIG_SAMPLE_TIME ( 0xF0 )
#define SDFM_CFG_NC_PRD_IEP_CNT_OFFSET ( 0xF4)

View File

@ -216,6 +216,11 @@ init_sdfm_cont:
LDI32 OUT_SAMP_BUF_REG, OUT_SAMP_BUF
LDI SAMP_CNT_REG, 0
LBCO &EN_DOUBLE_UPDATE, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_EN_DOUBLE_UPDATE, 1
;NC continuous mode status
LBCO &TEMP_REG0.b0, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_EN_CONT_NC_MODE,1
LSL TEMP_REG0.b0, TEMP_REG0.b0,1
OR EN_DOUBLE_UPDATE, EN_DOUBLE_UPDATE, TEMP_REG0.b0
LDI SAMP_NAME, 0
@ -605,7 +610,29 @@ wait_sample_count_incr_oc:
M_ACC3_PROCESS ACC3_DN1_CH2, ACC3_DN3_CH2, ACC3_DN5_CH2
; Save output sample to local output sample buffer
SBBO &CN5, OUT_SAMP_BUF_REG, 8, 4
;continuous mode check
QBBC TRIGGER_MODE, EN_DOUBLE_UPDATE, 1
;update IEP0 CMP4
LBCO &TEMP_REG0, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_NC_PRD_IEP_CNT_OFFSET, 4
LBCO &TEMP_REG1, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4 ;
ADD TEMP_REG0, TEMP_REG1, TEMP_REG0
;read iep counter maximum value
LDI TEMP_REG1, 0
LBCO &TEMP_REG1, CT_PRU_ICSSG_LOC_DMEM, SDFM_CFG_IEP_CFG_SIM_EPWM_PRD_OFFSET, 4
QBLE UPDATE_CMP_FOR_IEP_RESET, TEMP_REG0, TEMP_REG1
;update Cmp4 with old value + next sample time value
SBCO &TEMP_REG0, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4
JMP END_CMP_UPDATE
UPDATE_CMP_FOR_IEP_RESET:
;Update cmp4 according to iep reset
SUB TEMP_REG0, TEMP_REG0, TEMP_REG1
SBCO &TEMP_REG0, CT_PRU_ICSSG_IEP0, ICSSG_IEP_CMP4_REG0, 4
END_CMP_UPDATE:
JMP END_RESET_NC_FRAME
TRIGGER_MODE:
;Check NC sample count
QBLE RESET_NC_FRAME, SAMP_CNT_REG, NC_SAMP_CNT-1
; NC sample count < NC_SAMP_CNT-1
@ -619,7 +646,7 @@ wait_sample_count_incr_oc:
ADD SAMP_CNT_REG, SAMP_CNT_REG, 1 ; increment NC sample count
QBA NRESET_NC_FRAME
RESET_NC_FRAME:
; Set IEP CMP$ value: IEP_CMP4_REG1:REG0 = 0:TRIG_SAMPLE_TIME
QBBS FIRST_NC_SAMPLE, SAMP_NAME, 0

View File

@ -66,7 +66,10 @@ const uint32_t pru_SDFM_PRU0_image_0[] = {
0x240000d4,
0x24020094,
0x2400001c,
0x91e8187c,
0x91ea187c,
0x91e81801,
0x09010101,
0x12017c7c,
0x2400003c,
0x91001a01,
0x1f00e1e1,
@ -237,6 +240,18 @@ const uint32_t pru_SDFM_PRU0_image_0[] = {
0x10e7e7f1,
0x10f5e8e8,
0xe1083488,
0xc9017c0c,
0x91f43881,
0x91983a82,
0x00e1e2e1,
0x240000e2,
0x91083882,
0x58e2e103,
0x81983a81,
0x2100f400,
0x04e2e1e1,
0x81983a81,
0x21010700,
0x59031c07,
0x91f43881,
0x91983a82,

View File

@ -328,6 +328,39 @@ uint32_t SDFM_getPwmTripStatus(sdfm_handle h_sdfm, uint8_t pwmIns);
void SDFM_clearPwmTripStatus(sdfm_handle h_sdfm, uint8_t pwmIns);
/**
*
* \brief This API enbale continuous normal current sampling
*
* \param[in] h_sdfm SDFM handle
*
*
*/
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
/**
*
* \brief This API enbale continuous normal current sampling
*
* \param[in] h_sdfm SDFM handle
*
*
*/
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
/**
*
* \brief This API enbale continuous normal current sampling
*
* \param[in] h_sdfm SDFM handle
*
*
*/
void SDFM_enableContinuousNormalCurrent(sdfm_handle h_sdfm);
/**
*
* \brief Measure Clock phase compensation

View File

@ -153,8 +153,9 @@ typedef struct SDFM_CfgSdClk_s
*/
typedef struct SDFM_CfgTrigger_s
{
volatile uint8_t en_continuous_mode;
/**< bit-field for enable double update */
volatile uint16_t en_double_nc_sampling;
volatile uint8_t en_double_nc_sampling;
/**< First sample starting point */
volatile uint32_t first_samp_trig_time;
/**<Second sample starting point*/