Unwanted CAN signal is transmitted, also want VLPS exit via CAN RX.

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

Unwanted CAN signal is transmitted, also want VLPS exit via CAN RX.

421件の閲覧回数
Oido
Contributor I

I'm using s32k144 and sometimes the can signal is sent from mcu. Also
I want to use VLPS mode and get out of VLPS mode using CAN RX (PTE4). I know that I can't just get out of VLPS mode using RX by referring to the data sheet.

1. I set up to enter VLPS after 5 seconds after I timed it with LPTMR and just before entering VLPS, I changed PTE4(RX) to GPIO and set PORTE interrupt. And while exiting VLPS, I disabled the interrupt again and changed PTE4 to MUX5.

But this is a problem, sometimes when the sleep counter reaches 5000, it zeroes the counter and doesn't enter the VLPS, it constantly rises 6000 10000. Of course, until this happens, the MCU wakes up when VECTOR gives a signal. When the constant counter rises, even if you press the WAKE switch, the counter goes to zero, but it constantly rises again and stops at the part where it reactivates the clock without WAKE. I need to re-energize the power.
May I know what the issue is? I never had this when I cleared the RX and PORTE related interrupt.

 

2. Sometimes an unwanted CAN signal is sent to the REMOTE type.
From the MCU to the VECTOR program.

My CAN code is part of the code I got from examples like COOKBOOK and Datasheet.

I try to post CAN code but I think I've erased all the REMOTE-related parts

 

 

CAN.jpg

void CAN0_Init(void)
{
#define MSG_BUF_SIZE  18 //버퍼 사이즈
uint32_t   i=0;
//WDOG_disable();
PCC->PCCn[PCC_FlexCAN0_INDEX] |= PCC_PCCn_CGC_MASK; //CAN0 활성화
CAN0->MCR |= CAN_MCR_MDIS_MASK; //CAN 비활성화
CAN0->MCR |= CAN_MCR_MAXMB(31); //CAN 비활성화
CAN0->CTRL1 |= CAN_CTRL1_CLKSRC_MASK; //외부클럭 사용
CAN0->MCR &= ~CAN_MCR_MDIS_MASK; //CAN 활성화
while (!((CAN0->MCR & CAN_MCR_FRZACK_MASK) >> CAN_MCR_FRZACK_SHIFT))  {} //대기
 
CAN0->CBT = CAN_CBT_BTF_MASK|CAN_CBT_EPRESDIV(1)|CAN_CBT_EPSEG2(7)|CAN_CBT_EPSEG1(29)|CAN_CBT_EPROPSEG(0)|CAN_CBT_ERJW(7);
CAN0->FDCBT = CAN_CBT_EPSEG2(1)|CAN_CBT_EPSEG1(6)|CAN_CBT_EPROPSEG(0)|CAN_CBT_ERJW(1)|CAN_FDCBT_FPRESDIV(1);
CAN0->FDCTRL = CAN_FDCTRL_FDRATE_MASK|CAN_FDCTRL_MBDSR0(3)|CAN_FDCTRL_TDCEN_MASK|CAN_FDCTRL_TDCOFF(5);//CBT FDCBT클럭에 맞게
 
for(i=0; i<31; i++ ) {    //메시지 버퍼 전체 초기화
CAN0->RAMn[i] = 0;
}
for(i=0; i<31; i++ ) {
CAN0->RXIMR[i] = 0xFFFFFFFF;  //메시지 개별적 필터링인데 0x1FFFFFFF는 모든 메시지 허용
}
CAN0->RXMGMASK = 0x1FFFFFFF;  //수신된 메시지가 버퍼로 저장되기 전 필터링 0x1FFFFFFF는 모든 메시지 허용
 
CAN0->RAMn[ 1*MSG_BUF_SIZE + 0] = 0xC4000000; //CS설정 데이터시트 1712페이지
CAN0->RAMn[ 1*MSG_BUF_SIZE + 1] = 0x04000000; //ID 0x100
 
CAN0->RAMn[ 2*MSG_BUF_SIZE + 0] = 0xC4000000; //CS설정 데이터시트 1712페이지
CAN0->RAMn[ 2*MSG_BUF_SIZE + 1] = 0x08940000; //ID 0x225
 
CAN0->RAMn[ 3*MSG_BUF_SIZE + 0] = 0xC4000000; //CS설정 데이터시트 1712페이지
CAN0->RAMn[ 3*MSG_BUF_SIZE + 1] = 0x15540000; //ID 0x555
 
CAN0->CTRL2 = CAN_CTRL2_ISOCANFDEN_MASK;       //ISO CANFD 온
CAN0->MCR = 0x0000081F;       //CAN FD 온 및
while ((CAN0->MCR && CAN_MCR_FRZACK_MASK) >> CAN_MCR_FRZACK_SHIFT)  {}
 
while ((CAN0->MCR && CAN_MCR_NOTRDY_MASK) >> CAN_MCR_NOTRDY_SHIFT)  {}
 
}
 
 
void CAN0RX(void)
{
uint8_t j;
 
//RxCODE   = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 0] & 0x07000000) >> 24;  //CODE 7
//RxID     = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 1] & CAN_WMBn_ID_ID_MASK)  >> CAN_WMBn_ID_ID_SHIFT ;
//RxLENGTH = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 0] & CAN_WMBn_CS_DLC_MASK) >> CAN_WMBn_CS_DLC_SHIFT;
 
RxDATA[8] = CAN0->RAMn[ 1*MSG_BUF_SIZE + 10]; // 브레이크
if((RxDATA[8]&0x01000000)==0x01000000)
{
}
else
{
}
 
 
RxDATA2[0] = CAN0->RAMn[ 2*MSG_BUF_SIZE + 2]; // 0x225아이디로 첫번째 4바이트에서 맨 마지막 비트에 1,2,4 들어가면 정지 정 역
if((RxDATA2[0]&0x00000001)==0x00000001){
Direction=0;
}
else if((RxDATA2[0]&0x00000002)==0x00000002){
Direction=1;
}
else if((RxDATA2[0]&0x00000004)==0x00000004){
Direction=2;
}
for (j=0; j<2; j++) {  //데이터 읽기 8바이트씩
RxDATA3[j] = CAN0->RAMn[ 3*MSG_BUF_SIZE + 2 + j];
}
//RxTIMESTAMP = (CAN0->RAMn[ 0*MSG_BUF_SIZE + 0] & 0x000FFFF);
CAN0->IFLAG1 = 0x00000010;
}
 
 
--------
When I activate PORTE interrupt for RX and WAKE with a switch or can, I get a problem where it's clock related.
깨.jpg
 
0 件の賞賛
返信
2 返答(返信)

399件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) some VLPS example is posted at https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-RTC-VLPS/ta-p/1119655 you can refer to it

2) initialize whole MB area, not just first 32 MB area words. Also with 64 byte payload setting there is 7MBs available so MCR[MAXMB] should be 6, I think.

BR, Petr

0 件の賞賛
返信

372件の閲覧回数
Oido
Contributor I

답변 해 주셔서 감사합니다.
그러나 그 예는 다른 방식으로 VLPS를 종료하는 것으로 보입니다.
VLPS에 들어가기 직전에 인터럽트 FALLING EDGE를 설정하고 CAN 신호로 깨우고 싶은데 잘 작동합니다.
그러나 PORTE 인터럽트만 설정하면 VLPS에서 깨어나는 동안 클럭 부분에 문제가 발생하는 경우가 있습니다. PORTE 인터럽트를 활성화하지 않으면 CAN WAKE UP을 제외하고는 제대로 작동합니다.

0 件の賞賛
返信