Skip to main content
ZSQ.1
Associate
July 29, 2020
Solved

got stuck in SPCSetRunMode() in __early_init()

  • July 29, 2020
  • 7 replies
  • 3245 views

my SPC5studio version is 6.0.0,my UDE STK version is 5.0

    This topic has been closed for replies.
    Best answer by ZSQ.1

    after few days using SPC5studio,I found that the way to solve this problem may not be change your SPC5studio version,you can check your frequency of External crystal , and check whether or not it is corresponding to the Settings of your SPC5studio!!!!

    7 replies

    ZSQ.1
    ZSQ.1Author
    Associate
    July 29, 2020

    I have see other QAs,but i can not find a proper method for my project

    ZSQ.1
    ZSQ.1Author
    Associate
    July 29, 2020

    0693W000003BaYhQAK.png

    Erwan YVIN
    ST Employee
    August 13, 2020

    Hello ,

    For this case , it is often a configuration clock issue.

    Which Board do you use ?

    Best Regards

    Erwan

    ZSQ.1
    ZSQ.1Author
    Associate
    July 29, 2020

    and my main function is:

    /* Inclusion of the main header files of all the imported components in the
     order specified in the application wizard. The file is generated
     automatically.*/
    #include "components.h"
    #include "can_lld_cfg.h"
     
    /**
     * FLEXCAN Error callback. Interrupt sources managed are: Bus Off, Error, Tx Warning and Rx Warning.
     *
     * canp Pointer to the @p CAN Driver object triggering the error
     * esr ESR Register Value
     * rx_err_counter Receive Error Counter
     * tx_err_counter Transmit Error Counter
     */
    void cfg0_errorcb(CANDriver *canp, uint32_t esr,uint8_t rx_err_counter, uint8_t tx_err_counter){
     /* Put error management code Here */
     (void)canp;
     (void)esr;
     (void)rx_err_counter;
     (void)tx_err_counter;
    }
     
    /**
     * FIFO notification callback
     *
     * canp pointer to the @p CAN Driver object triggering the callback
     * crfp RX frame containg data
     */
    void cfg0_Fifo_RX(CANDriver *canp, CANRxFrame crfp) {
     if (crfp.IDE == CAN_IDE_EXT && crfp.EID == 0x70U) {
    	 // pal_lld_togglepad(PORT_E, PE_LED1);
     }
     if (crfp.IDE == CAN_IDE_STD && crfp.SID == 0x11U) {
    	// pal_lld_togglepad(PORT_E, PE_LED2);
     
     }
     (void)canp;
     }
     
     /*
     * Application entry point.
     */
     int main(void) {
     
     CANTxFrame txmsg;
     CANRxFrame rxmsg;
     
     	/* Initialization of all the imported components in the order specified in
     	 the application wizard. The function is generated automatically.*/
     componentsInit();
     
     /* Enable Interrupts */
     irqIsrEnable();
     
     /*
     * Activates the CAN driver 1.
     */
     can_lld_start(&CAND1, &can_config_cfg0);
     
     /*
     * CAN TX Message structure.
     */
     txmsg.IDE = CAN_IDE_EXT;
     txmsg.RTR = CAN_RTR_DATA;
     txmsg.LENGTH = 8U;
     txmsg.data32[0] = 0x55AA55AAU;
     txmsg.data32[1] = 0x00000000UL;
     
     /* Application main loop.*/
     for ( ; ; ) {
     txmsg.data32[1]++;
     
     /* Transmit Can message received by mailbox */
     txmsg.IDE = CAN_IDE_EXT;
     txmsg.EID = 0x8901234UL;
     while (can_lld_transmit(&CAND1, 1, &txmsg) == CAN_MSG_WAIT) {
     }
     
     /* Transmit Can message received by FIFO */
     txmsg.IDE = CAN_IDE_EXT;
     txmsg.EID = 0x70;
     while (can_lld_transmit(&CAND1, 2, &txmsg) == CAN_MSG_WAIT) {
     	}
     
     /* Transmit Can message received by mailbox */
     txmsg.IDE = CAN_IDE_STD;
     txmsg.SID = 0x11L;
     while (can_lld_transmit(&CAND1, 3, &txmsg) == CAN_MSG_WAIT) {
     }
     
     	/*
     	* Receives the RX CAN Message.
     	*/
     if (can_lld_receive(&CAND1, 1, &rxmsg) == CAN_MSG_OK) {
     	// pal_lld_togglepad(PORT_E, PE_LED3);
     }
     
     osalThreadDelayMilliseconds(250UL);
     }
     }

    ZSQ.1
    ZSQ.1Author
    Associate
    July 29, 2020

    i have change the samples code, and i change the platform from SPC560B50L5 to SPC560B50L1,and remove PE_LED1-PE_LED4 in Board Initialization Component. other contents that I have no change.

    ZSQ.1
    ZSQ.1Author
    Associate
    July 29, 2020

    I have test the PIT samples code,but it doesn't work as well.

    ZSQ.1
    ZSQ.1Author
    Associate
    July 31, 2020

    I have already fixed my problem, the reason is my SPC5studio version, I have replaced it with the version which was provided by ST technology support.​

    ZSQ.1
    ZSQ.1AuthorBest answer
    Associate
    August 22, 2020

    after few days using SPC5studio,I found that the way to solve this problem may not be change your SPC5studio version,you can check your frequency of External crystal , and check whether or not it is corresponding to the Settings of your SPC5studio!!!!

    DKuma.3
    Associate II
    July 29, 2021

    Hi,

    May I ask you more details, how you solved the problem.

    I am having exactly the same issue.

    My target board is SPC582B60E1 (64 pin)

    SPC5studio version is 6.0.0 and my UDE STK version is 5.0

    Stuck in SPCSetRunMode() in __early_init()

    Please share your experience little more elaborate way.

    I have checked External oscillator setting as you mentioned. My external oscillator is 40MHz and SPC5 studio setting also have same value.

    Regards

    D.Kumar

    Visitor II
    November 29, 2023

    Hi,
    I know this is an old post but i am having the same problem.

    My target board is also SPC582B. Could you solve the problem and do you still knwo the solution?

    Regards