Switching to 2MHz clock stops in bsp

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

Switching to 2MHz clock stops in bsp

ソリューションへジャンプ
1,568件の閲覧回数
Andrey
Contributor III

I'm using IAR 7.3, MQX 4.1.1, K70. When I perform a switch to 2MHz clock it runs away in Cpu_SetMCGModeFBI(CLKMode),

right at line MCG_C1 = (uint8_t)0x46U; neer gets past that. As if something is interrupting it.

and eventually breaks with [KERNEL_DATA$$Limit + 0x387c] in the call stack window.

/* Switch to FBI Mode */

      /* MCG_C1: CLKS=1,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */

      MCG_C1 = (uint8_t)0x46U;

      /* MCG_C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=0,LP=0,IRCS=1 */

      MCG_C2 = (uint8_t)0x21U;

      /* MCG_C4: DMX32=0,DRST_DRS=0 */

      MCG_C4 &= (uint8_t)~(uint8_t)0xE0U;

      /* OSC0_CR: ERCLKEN=0,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */

      OSC0_CR = (uint8_t)0x00U;

      /* MCG_C10: LOCRE2=0,??=0,RANGE1=2,HGO1=1,EREFS1=1,??=0,??=0 */

      MCG_C10 = (uint8_t)0x2CU;

      /* OSC1_CR: ERCLKEN=0,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */

      OSC1_CR = (uint8_t)0x00U;

      /* MCG_C7: OSCSEL=0 */

      MCG_C7 &= (uint8_t)~(uint8_t)0x01U;

      /* MCG_C5: PLLREFSEL0=0,PLLCLKEN0=0,PLLSTEN0=0,??=0,??=0,PRDIV0=0 */

      MCG_C5 = (uint8_t)0x00U;

       /* MCG_C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */

       MCG_C6 = (uint8_t)0x00U;             /* 7 */

       /* MCG_C11: PLLREFSEL1=0,PLLCLKEN1=0,PLLSTEN1=0,PLLCS=0,??=0,PRDIV1=0 */

       MCG_C11 = (uint8_t)0x00U;            /* 7 */

       /* MCG_C12: LOLIE1=0,??=0,CME2=0,VDIV1=0 */

       MCG_C12 = (uint8_t)0x00U;            /* 7 */

      while((MCG_S & MCG_S_IREFST_MASK) == 0x00U) { /* Check that the source of the FLL reference clock is the internal reference */

      }

      while((MCG_S & 0x0CU) != 0x04U) { /* Wait until internal reference clock is selected as MCG output */

      }

      break;

    default:

      break;

Thanks,

Andy

タグ(3)
0 件の賞賛
返信
1 解決策
1,389件の閲覧回数
Andrey
Contributor III

I found the issue. It had to do with the BSP_NAME which i changed to a custom one.

UPDATE:

Apparently it is something else. Perhaps an IAR issue. If you reset the debugger and have a breakpoint an error occurs.

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,390件の閲覧回数
Andrey
Contributor III

I found the issue. It had to do with the BSP_NAME which i changed to a custom one.

UPDATE:

Apparently it is something else. Perhaps an IAR issue. If you reset the debugger and have a breakpoint an error occurs.

0 件の賞賛
返信
1,389件の閲覧回数
soledad
NXP Employee
NXP Employee

Thank you for share your solution !!

Regards

Sol

0 件の賞賛
返信
1,388件の閲覧回数
soledad
NXP Employee
NXP Employee

Hello Andy,

Attached  you can find a document that shows how-to Change Default Clock Settings in Kinetis BSPs

I hope this helps!!


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
1,388件の閲覧回数
Andrey
Contributor III

I've gone through the How-To, but I'm not trying to change anything, I've compared bsp_cm and bsp_cm.h files to the original MQX files and they are fine. There seems to be something outside of that that's breaking the program execution. I've also tried to start-up with 2MHz clock, and get the same issue at the same spot.

0 件の賞賛
返信