Part Number:TMS320F28379DOther Parts Discussed in Thread:AMC1305M25, C2000WARE
SDIFLG 的 Modulator failure for Filter 1~Modulator failure for Filter 4全部为1,时钟与码流都进入SD,SC脚了。就是读不到数据
Susan Yang:
能否给出您现在使用的软硬件详细情况?
jinyan fan 说:SDIFLG 的 Modulator failure for Filter 1~Modulator failure for Filter 4全部为1,时钟与码流都进入SD,SC脚了
请给出相关的说明或截图,谢谢
,
jinyan fan:
PWM1给出6.25M的时钟,1305输出的码流正常。 Modulator failure for Filter 1正常了。但是还是读不到转换值。
以下是SDFM配置
void main(void){ uint16_t pinMuxoption; uint16_t HLT, LLT; InitSysCtrl(); DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; PieVectTable.SD1_INT = &Sdfm1_ISR; PieVectTable.SD2_INT = &Sdfm2_ISR; EDIS;
EALLOW;
IER |= M_INT5;
PieCtrlRegs.PIEIER5.bit.INTx9 = 1; // SDFM1 interrupt enabled PieCtrlRegs.PIEIER5.bit.INTx10 = 1; // SDFM2 interrupt enabled EINT;
#ifdef CPU1 pinMuxoption = SDFM_PIN_MUX_OPTION3; Sdfm_configurePins(pinMuxoption);#endif
gPeripheralNumber = SDFM1;
Sdfm_configureInputCtrl(gPeripheralNumber, FILTER1, MODE_0); Sdfm_configureInputCtrl(gPeripheralNumber, FILTER2, MODE_0); Sdfm_configureInputCtrl(gPeripheralNumber, FILTER3, MODE_0); Sdfm_configureInputCtrl(gPeripheralNumber, FILTER4, MODE_0);
HLT = 0x7FFF; //Over value threshold settings LLT = 0x0000; //Under value threshold settings
Sdfm_configureComparator(gPeripheralNumber, FILTER1, SINC3, OSR_32, HLT, LLT); Sdfm_configureComparator(gPeripheralNumber, FILTER2, SINC3, OSR_32, HLT, LLT); Sdfm_configureComparator(gPeripheralNumber, FILTER3, SINC3, OSR_32, HLT, LLT); Sdfm_configureComparator(gPeripheralNumber, FILTER4, SINC3, OSR_32, HLT, LLT);
Sdfm_enableMFE(gPeripheralNumber);
Sdfm_configureData_filter(gPeripheralNumber, FILTER1, FILTER_ENABLE, SINC3, OSR_256, DATA_16_BIT, SHIFT_0_BITS);// Sdfm_configureData_filter(gPeripheralNumber, FILTER2, FILTER_ENABLE, SINC3,// OSR_256, DATA_16_BIT, SHIFT_9_BITS);// Sdfm_configureData_filter(gPeripheralNumber, FILTER3, FILTER_ENABLE, SINC3,// OSR_256, DATA_16_BIT, SHIFT_9_BITS);// Sdfm_configureData_filter(gPeripheralNumber, FILTER4, FILTER_ENABLE, SINC3,// OSR_256, DATA_16_BIT, SHIFT_9_BITS);
Sdfm_configureExternalreset(gPeripheralNumber,FILTER_1_EXT_RESET_ENABLE, FILTER_2_EXT_RESET_ENABLE, FILTER_3_EXT_RESET_ENABLE, FILTER_4_EXT_RESET_ENABLE);
InitEPwm();
Sdfm_configureInterrupt(gPeripheralNumber, FILTER1, IEH_DISABLE, IEL_DISABLE, MFIE_ENABLE, AE_ENABLE); Sdfm_configureInterrupt(gPeripheralNumber, FILTER2, IEH_DISABLE, IEL_DISABLE, MFIE_ENABLE, AE_ENABLE); Sdfm_configureInterrupt(gPeripheralNumber, FILTER3, IEH_DISABLE, IEL_DISABLE, MFIE_ENABLE, AE_ENABLE); Sdfm_configureInterrupt(gPeripheralNumber, FILTER4, IEH_DISABLE, IEL_DISABLE, MFIE_ENABLE, AE_ENABLE);
while((*EPWM[gPWM_number]).TBCTR < 3);
Sdfm_enableMIE(gPeripheralNumber);
下面是对SDFM数据寄存器读取转换值,中断能过来,感觉是FM2,3,4产生的中断,不是转换结束的中断。
__interrupt void Sdfm1_ISR(void){
static uint16_t loopCounter1 = 0; test4++; // // Read SDFM flag register (SDIFLG) // sdfmReadFlagRegister = Sdfm_readFlagRegister(gPeripheralNumber);
if(loopCounter1 < MAX_SAMPLES) { // // Read each SDFM filter output and store it in respective filter // result array // Filter1_Result[loopCounter1] = SDFM1_READ_FILTER1_DATA_16BIT; Filter2_Result[loopCounter1] = SDFM1_READ_FILTER2_DATA_16BIT; Filter3_Result[loopCounter1] = SDFM1_READ_FILTER3_DATA_16BIT; Filter4_Result[loopCounter1++] = SDFM1_READ_FILTER4_DATA_16BIT;
// Clear SDFM flag register // //Sdfm_clearFlagRegister(gPeripheralNumber,sdfmReadFlagRegister); //sdfmReadFlagRegister = Sdfm_readFlagRegister(gPeripheralNumber);
if(sdfmReadFlagRegister != 0x0) { // ESTOP0; } } else { // ESTOP0; // done(); } Sdfm_clearFlagRegister(gPeripheralNumber,sdfmReadFlagRegister); sdfmReadFlagRegister = Sdfm_readFlagRegister(gPeripheralNumber); // // Acknowledge this __interrupt to receive more __interrupts from group 5 // PieCtrlRegs.PIEACK.all = PIEACK_GROUP5;}
还有其他要注意的点吧,要不然会读到数值啊?
,
Susan Yang:
谢谢反馈。您的硬件部分呢?使用的是TI开发板还是自制板?是否有使用TI例程尝试?
,
jinyan fan:
是开发板啊,这个就是例程,只不过将CLK改快了。
,
jinyan fan:
是开发板啊,这个就是例程,只不过将CLK改快了。
,
jinyan fan:
用的PWM1A作为CLK
,
Susan Yang:
请注意
//! \b External \b Connections \n//! – SDFM_PIN_MUX_OPTION1 Connect Sigma-Delta streams to//! (SD-D1, SD-C1 to SD-D8,SD-C8) on GPIO16-GPIO31//! – SDFM_PIN_MUX_OPTION2 Connect Sigma-Delta streams to//! (SD-D1, SD-C1 to SD-D8,SD-C8) on GPIO48-GPIO63//! – SDFM_PIN_MUX_OPTION3 Connect Sigma-Delta streams to//! (SD-D1, SD-C1 to SD-D8,SD-C8) on GPIO122-GPIO137
您直接完全使用例程时是可以正常读出的吗?
jinyan fan 说:用的PWM1A作为CLK
一旦您将PWM用于为 SDFM 模块提供时钟,请您检查 EPWM 输出。请您调试下程序,看会卡在哪里,是否会进入SDFM的中断
,
jinyan fan:
不能读出来,我们用的IO口是GPIO122,GPIO123
,
Susan Yang:
抱歉,手边没有AM1305,不太好测试。请您参考下面的文档
隔离信号调制器 AMC1305M25 与 F28377S 最小系统与测试
https://www.ti.com.cn/cn/lit/an/zhca818/zhca818.pdf
,
jinyan fan:
该问题已经解决了,但是不知道为什么,换了例程就好了。
,
jinyan fan:
我还想请教个问题,SDFM采样的节奏怎么控制的,ADC采样有触发机制比如PWM触发,SDFM采样用什么来触发,如果没有触发机制,那SDFM采样岂不是要连续采样,时间上怎么与PWM中断对齐呢?
,
Susan Yang:
jinyan fan 说:如果没有触发机制,那SDFM采样岂不是要连续采样,时间上怎么与PWM中断对齐呢?
SDFM 是滑动窗口滤波器(或)移动平均滤波器。SDFM 不会在每个 SD-Cx 时钟周期输出。它会在每个 OSR x SD-Cx 周期更新。
从理论上讲,如果您有一个适用于所有滤波器通道的 SD-Cx 源,则它们已经同步。我们具有同步功能,可以根据 PWM 周期读取 SDFM 滤波器结果的时间。SYNC 功能不仅仅是同步 SDFM 中的所有滤波器模块。
您可以看一下SDFM的相关例程
C2000Ware\device_support\f2837xd\examples\cpu1
除非禁用过滤器,否则您无法在 OSR SD-Cx 周期停止 SDFM 泵送数据。但是,您可以将 SDFM FIFO 配置为仅在需要时中断。