CAN bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN bootloader

970 Views
gj3526
Contributor III

Hi,

         I  designed a bootloader based on can. In app, it can jump to bootloader when received the fixed information through can . However,  the program will crashed in can initialization after jumping to bootloader .so I have a test as  atachment,In the program,I changed the address,so it can not jump to bootloader but jumped to the App again,the program also crashed when can Initializing.I find the problems through debug.

CAN_Type * base = g_flexcanBase[instance]; ------->it can not get the status of CAN  rgisters

     so how to deal with it?

Best regards,

Jun Gong

0 Kudos
3 Replies

839 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi, 

I have tried given project on DEVKIT and it passes CAN init normally.

BR, Petr

0 Kudos

839 Views
gj3526
Contributor III

Hi Petr,

      Sorry I did not make it clear,After the program runing ,use CAN tool send "ID:7F6 data:08 1e 12 15 6d 5f c9 ed",the program will jump to 0x01000000 (in my opinion,it is the same as reboot),but it will crashed in can initialization.

   as flow in can.c

                    for(cnt=590;cnt<599;cnt++)//CAN2_Error_IRQn
                    {
                        INT_SYS_DisableIRQ_MC_All(cnt);
                    }
                    INT_SYS_DisableIRQGlobal();
                    INT_SYS_DisableIRQ_MC_All(PIT_Ch15_IRQn);
                    __asm__("e_lis %r12,0x00FA");
                    __asm__("e_or2i %r12,0x0010");
                    __asm__("e_lwz %r0,0(%r12)");
                    __asm__("se_mtlr %r0");
                    __asm__("se_blrl");

Best regards,

Jun Gong

0 Kudos

839 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

OK, after test you mentioned, I found that the Mode Transition, which is done on clock init, is pending due to previous active peripheral clock (PIT ch15). This channel is used by OSIF driver that uses a hardware timer to accurately measure time. OSIF is called when blocking function is used.

So you should disable PIT module before reinit is requested. use below code before your asm lines

PIT->MCR |= PIT_MCR_MDIS_MASK;

 __asm__("e_lis %r12,0x00FA");
 __asm__("e_or2i %r12,0x0010");

....

BR, Petr

0 Kudos