реклама на сайте
подробности

 
 
> LPC23XX+CAN Фильтрация
Dolpeen
сообщение Dec 13 2009, 17:04
Сообщение #1





Группа: Участник
Сообщений: 3
Регистрация: 12-04-08
Пользователь №: 36 712



Не могу настроить работу CAN на фильтрацию.
Пробовал и на LPC2368 и LPC2366.
В режиме BYPASS все OK.
Если выбираю режим фильтрации все - ТИШИНА.
Пробовал и на индивидуальных и групповых индификаторах без разницы.

Подскажите, кто в курсе.

CODE
CAN_AFMR = 0x00000001; //Disable the Acceptance filters to allow setup of the table

FilterPtr = (volatile DWORD *)0xE0038000; //Set pointer to start of acceptance filter menory
*(volatile DWORD *)FilterPtr = 0x460E460D; //Write values to the Standard acceptance filter table
FilterPtr++; //Increment pointer by four bytes
*(volatile DWORD *)FilterPtr = 0x400047FF; //Write values to the Standard acceptance filter table

CAN_SFF_SA = 0x00000000; //Set start address of Standard table
CAN_SFF_GRP_SA = 0x00000004; //Set start address of Standard group table
CAN_EFF_SA = 0x00000008; //Set start address of Extended table
CAN_EFF_GRP_SA = 0x00000008; //Set start address of Extended group table
CAN_EOT = 0x00000008; //Set end of table addr

CAN_AFMR = 0x00000000; //Enable Acceptance filters

CAN2IER = 1; // Enable Receive Interrupt
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов (1 - 1)
mrlee
сообщение Dec 17 2009, 10:02
Сообщение #2





Группа: Участник
Сообщений: 8
Регистрация: 11-03-05
Пользователь №: 3 247



Цитата(Dolpeen @ Dec 13 2009, 20:04) *
Не могу настроить работу CAN на фильтрацию.
Пробовал и на LPC2368 и LPC2366.
В режиме BYPASS все OK.
Если выбираю режим фильтрации все - ТИШИНА.
Пробовал и на индивидуальных и групповых индификаторах без разницы.

Подскажите, кто в курсе.

CODE
CAN_AFMR = 0x00000001; //Disable the Acceptance filters to allow setup of the table

FilterPtr = (volatile DWORD *)0xE0038000; //Set pointer to start of acceptance filter menory
*(volatile DWORD *)FilterPtr = 0x460E460D; //Write values to the Standard acceptance filter table
FilterPtr++; //Increment pointer by four bytes
*(volatile DWORD *)FilterPtr = 0x400047FF; //Write values to the Standard acceptance filter table

CAN_SFF_SA = 0x00000000; //Set start address of Standard table
CAN_SFF_GRP_SA = 0x00000004; //Set start address of Standard group table
CAN_EFF_SA = 0x00000008; //Set start address of Extended table
CAN_EFF_GRP_SA = 0x00000008; //Set start address of Extended group table
CAN_EOT = 0x00000008; //Set end of table addr

CAN_AFMR = 0x00000000; //Enable Acceptance filters

CAN2IER = 1; // Enable Receive Interrupt



Если проблему еще не решили могу предлоить кусок из примера от NXP вполне понятно и подробно все показывает как пользоваться.
Для всех типов фильтрации

/******************************************************************************
** Function name: CAN_SetACCF_Lookup
**
** Descriptions: Initialize CAN, install CAN interrupt handler
**
** parameters: bitrate
** Returned value: true or false, false if initialization failed.
**
******************************************************************************/
void CAN_SetACCF_Lookup( void )
{
DWORD address = 0;
DWORD i;
DWORD ID_high, ID_low;

// Set explicit standard Frame
CAN_SFF_SA = address;
for ( i = 0; i < ACCF_IDEN_NUM; i += 2 )
{
ID_low = (i << 29) | (EXP_STD_ID << 16);
ID_high = ((i+1) << 13) | (EXP_STD_ID << 0);
*((volatile DWORD *)(CAN_MEM_BASE + address)) = ID_low | ID_high;
address += 4;
}

// Set group standard Frame
CAN_SFF_GRP_SA = address;
for ( i = 0; i < ACCF_IDEN_NUM; i += 2 )
{
ID_low = (i << 29) | (GRP_STD_ID << 16);
ID_high = ((i+1) << 13) | (GRP_STD_ID << 0);
*((volatile DWORD *)(CAN_MEM_BASE + address)) = ID_low | ID_high;
address += 4;
}

// Set explicit extended Frame
CAN_EFF_SA = address;
for ( i = 0; i < ACCF_IDEN_NUM; i++ )
{
ID_low = (i << 29) | (EXP_EXT_ID << 0);
*((volatile DWORD *)(CAN_MEM_BASE + address)) = ID_low;
address += 4;
}

// Set group extended Frame
CAN_EFF_GRP_SA = address;
for ( i = 0; i < ACCF_IDEN_NUM; i++ )
{
ID_low = (i << 29) | (GRP_EXT_ID << 0);
*((volatile DWORD *)(CAN_MEM_BASE + address)) = ID_low;
address += 4;
}

// Set End of Table
CAN_EOT = address;
return;
}
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 23rd July 2025 - 19:49
Рейтинг@Mail.ru


Страница сгенерированна за 0.01321 секунд с 7
ELECTRONIX ©2004-2016