MQX 4.1.1 init_gpio.c potential bug

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX 4.1.1 init_gpio.c potential bug

589件の閲覧回数
kubiznak_petr
Contributor V

Hi,

MQX 4.1.1 brings the following patch to the file mqx/source/bsp/twrk70f120m/init_gpio.c:

@@ -811,7 +811,11 @@

             pctl->PCR[18] = PORT_PCR_MUX(4) | PORT_PCR_ODE_MASK;

             pctl->PCR[19] = PORT_PCR_MUX(4) | PORT_PCR_ODE_MASK;

-

+            /* Enable SDA rising edge detection */

+#if BSPCFG_ENABLE_LEGACY_II2C_SLAVE

+            pctl->PCR[18] |= PORT_PCR_IRQC(0x09);

+            pctl->PCR[18] |= PORT_PCR_ISF_MASK;

+#endif

             sim->SCGC4 |= SIM_SCGC4_IIC0_MASK ;

             break;

That visually seems to me like a potential bug, even though I have not examined it thoroughly. But as there are two lines in the conditioned block, I think it was meant to configure pins 18 and 19, not twice the same pin 18. Please correct me if I am wrong.

タグ(3)
0 件の賞賛
返信
1 返信

354件の閲覧回数
razed11
Contributor V

That conditional is an or-equal operation. The first line is setting the IRQC field in bits 16-19 and the second is setting the ISF bit 24 for PTC18. Looks like it is to be used as an external rising-edge interrupt.

The top two lines select alt function 4 for bits 8/9 on Port C which are I2S0 functions.

0 件の賞賛
返信