Tool/software:
Hi!
I am having trouble using the SDFM FIFO, or when not using the SDFM FIFO, consistently reading valid new filter data.
I am running the following function, triggered by a 10kHz ISR. The ISR is triggered from a 10kHz ePWM, I am not intending to use an SDFM data ready interrupt to know when to pull new filter data. I want to pull the most recent valid filter data in this ISR.
FIFO ISSUES
In the current function I see SDFM_getModulatorStatus constantly returns TRUE (system healthy)
In the current function I see SDFM_getFIFODataCount constantly return 0.
If I bypass SDFM_getFIFODataCount and just read SDFM_getFIFOData, the data returns 0.
SDFM_getFIFOData OBSERVATIONS
If I bypass SDFM_getFIFODataCount and replace SDFM_getFIFOData with SDFM_getFilterData, it returns valid data "most" of the time. There are 100x magnitude outliers that are read every couple seconds with no consistency, suggesting these outliers are invalid read data. The "accurate data" does follow a trend of the controlled injected current on the SDFM sensor, as I rise current, the SDFM data rises, as I lower, it lowers.
If I bypass SDFM_getFIFODataCount, replace SDFM_getFIFOData with SDFM_getFilterData, but only attempt to grab data when SDFM_getNewFilterDataStatus returns TRUE (new filter data is available), I never see SDFM_getNewFilterDataStatus return TRUE, always FALSE (no new filter data is available). This is odd bc SDFM_getFilterData by itself does return some accurate data.
void sdfm_readAllChannels(void) { for (uint8_t i = 0; i < 8; i++) { uint32_t base_addr = gSdfmBaseAddrs[channel_config->module]; uint32_t filter = channel_config->filter; bool modulator_status = SDFM_getModulatorStatus(base_addr, filter); if (modulator_status) { uint16_t fifo_data_count = SDFM_getFIFODataCount(base_addr, filter); if(fifo_data_count == 0){ raw_value = -1; } else if(fifo_data_count>=1) { uint32_t filter_data = SDFM_getFIFOData(base_addr, filter); raw_value = (int16_t)(filter_data >> CSL_SDFM_SDDATA1_DATA32HI_SHIFT); SDFM_clearWaitForSyncFlag(base_addr, filter); // Is this needed? } else { raw_value = -2; } } else { raw_value = -3; } raw_field[i] = raw_value; } // Clear interrupt flags for (uint32_t module = 0; module < SDFM_MODULE_COUNT; module++) { SDFM_clearInterruptFlag(gSdfmBaseAddrs[module], SDFM_MAIN_INTERRUPT_FLAG | 0xFFFF); // Is this needed? } }
Here are my syscfg settings per SDFM:
A few questions:
- How can I use the SDFM fifo correctly to get valid data at a 10kHz epwm triggered interrupt?
- If I dont use the fifo, what function can I use or settings to ensure I only grab valid data with SDFM_getFilterData? (SDFM_getNewFilterDataStatus always returns FALSE)
- Should I select the "Use PWM Synchronization" option with "SDFM sync source is PWM0 SOCA"? I want valid SDFM data at the same rate as my ePWM.
Thank you!