cancel
Showing results for 
Search instead for 
Did you mean: 

got stuck in SPCSetRunMode() in __early_init()

ZSQ.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
ZSQ.1
Associate II

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!!!!

View solution in original post

10 REPLIES 10
ZSQ.1
Associate II

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

ZSQ.1
Associate II

0693W000003BaYhQAK.png

ZSQ.1
Associate II

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
Associate II

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
Associate II

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

ZSQ.1
Associate II

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.​

Hello ,

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

Which Board do you use ?

Best Regards

Erwan

ZSQ.1
Associate II

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!!!!

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