FAQ | Points | Add... | Recent posts | Search | Register | Log in


[stm32] CAN i filtrowanie


Post new topic  Reply to topic      Main Page -> Forum Index -> Microcontrollers Generally -> ARM Microcontrollers -> [stm32] CAN i filtrowanie
Author
Message
tomj7
Poziom 17
Poziom 17


Joined: 25 Jan 2003
Posts: 391
Location: Kraków

Post#1 Post from the author of the topic 05 Mar 2010 22:58   

[stm32] CAN i filtrowanie


Właśnie uruchamiam magistrale CAN w STM32. Testuje transmisje w trybie loopback. Filtr musi być aktywny, aby można było odebrać ramkę CAN. Mam taki przykład do ustawiania jednego id.
Pytanie mam jak ustawić filtr, aby można było odbierać wszystkie id, czyli aby filtr przpuszczał wszystkie id standardowe CAN, albo ustawić wybrany zakres id.
Dokumentacja lakonicznie wpomina o maskach, ale nie mogę tego zatrybić.

Code:

CAN_msgId  |= (unsigned int)(id << 21) | CAN_ID_STD;
AN->FMR  |=  CAN_FMR_FINIT;                    // set Initialisation mode for filter banks
CAN->FA1R &=  ~(unsigned int)(1 << CAN_filterIdx); // deactivate filter
                                                  // initialize filter   
CAN->FS1R |= (unsigned int)(1 << CAN_filterIdx);// set 32-bit scale configuration
CAN->FM1R |= (unsigned int)(1 << CAN_filterIdx);// set 2 32-bit identifier list mode

CAN->F0R1 = CAN_msgId; //  32-bit identifier
CAN->F0R2 = CAN_msgId; //  32-bit identifier
                                              
CAN->FFA1R &= ~(unsigned int)(1 << CAN_filterIdx);  // assign filter to FIFO 0
CAN->FA1R  |=  (unsigned int)(1 << CAN_filterIdx);  // activate filter

CAN->FMR &= ~CAN_FMR_FINIT;                     // reset Initialisation mode for filter banks

Back to top
   
Google

Google Adsense


Post# Post from the author of the topic 05 Mar 2010 22:58   





Back to top
   
H0miczek
Poziom 15
Poziom 15


Joined: 07 Mar 2008
Posts: 239
Location: otfock

Post#2 06 Mar 2010 15:48   

Re: [stm32] CAN i filtrowanie


Maska nałozona na dany filtr to nic innego jak ustalenie ktore bity IDa muszą sie zgadzac.
dziala to na zasadzie , że dany ID jest przepuszczany jesli
(ID & maska) == (filtr & maska)
Czyli jak chcesz przepuszczac wszystko to maske ustawiasz na 0 (zero).
Back to top
   
Post new topic  Reply to topic      Main Page -> Forum Index -> Microcontrollers Generally -> ARM Microcontrollers -> [stm32] CAN i filtrowanie
Page 1 of 1
Similar topics
[STM32][eclipse/GCC] Bootloader CAN (8)
Filtrowanie komunikatów na magistali CAN (4)
[STM32][Keil][C]Filtrowanie CAN po ID - nie przepuszcza ramek (2)
[stm32]Czy programatorem do STM32 można programować ST7/STM8 (6)
[stm32] schemat płytki pod uC STM32 - czy poprawny? (5)
[stm32] Prosty układ. Prośba o pomoc. STM32 + enkoder (2)
[STM32 ARM Cortex M3] mp3 na STM32 Primer2 (7)
[STM32][CC1000] Stm32 i stan wysokiej impedancji (1)
[STM32][C][uVision] STM32 USB lib a StdPeriph (2)

Page generation time: 0.074 seconds


FAQ || Administrator || Moderators || Widgets and banners || Contact
elektroda.pl topic RSS feed