Information Center for ARM

Example description

  
CAN_LoopBack CAN LoopBack example
  
Example Description 

This example provides a description of how to set a communication with the CAN
in loopback mode.

The CAN cell first performs a transmission and a reception of a standard data
frame by polling at 125 Kbps. The received frame is checked and some LEDs light
up to indicate whether the communication was successful. Then, an extended data
frame is transmitted at 500 Kbps. Reception is done in the interrupt handler
when the message becomes pending in the FIFO. Finally, the LEDs indicate if both
transmission and reception have been successful.

User can select CAN1 or CAN2 cell using the defines in main.h :
#define USE_CAN1
/* #define USE_CAN2*/ 

  
Directory contents 

  - CAN/LoopBack/system_stm32f2xx.c   STM32F2xx system clock configuration file
  - CAN/LoopBack/stm32f2xx_conf.h     Library Configuration file
  - CAN/LoopBack/stm32f2xx_it.h       Interrupt handlers header file
  - CAN/LoopBack/stm32f2xx_it.c       Interrupt handlers
  - CAN/LoopBack/main.c               Main program

	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 


Hardware and Software environment 

  - This example runs on STM32F2xx Devices.

  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up 
    - Use LED1, LED2, LED3 and LED4 connected respectively to PG.06, PG.08, PI.09
      and PC.07 pins


===============================================================================

CAN_Networking CAN Networking example
  
Example Description 

This example shows how to configure the CAN peripheral to send and receive 
CAN frames in normal mode. The sent frames are used to control Leds by pressing  
key push button.
	
The CAN serial communication link is a bus to which a number of units may be
connected. This number has no theoretical limit. Practically the total number
of units will be limited by delay times and/or electrical loads on the bus line.

This program behaves as follows:
  - After reset LED1 is ON
  - By Pressing on KEY Button : LED2 turns ON and all other Leds are OFF, on the N
    eval boards connected to the bus. 
  - Press on KEY Button again to send CAN Frame to command LEDn+1 ON, all other Leds 
    are OFF on the N eval boards.
    
	  This example is tested with a bus of 3 units. The same program example is 
      loaded in all units to send and receive frames.
	  Any unit in the CAN bus may play the role of sender (by pressing KEY button)
      or receiver.
	
	The CAN is configured as follow:
    - Bit Rate   = 1 Mbit/s  
    - CAN Clock  = external clock (HSE)
		- ID Filter  = All identifiers are allowed
		- RTR = Data
		- DLC = 1 byte
		- Data: Led number that should be turned ON

User can select CAN1 or CAN2 cell using the defines in main.h :

#define USE_CAN1
/* #define USE_CAN2*/ 

      If you want to change the CAN Baudrate, please refer to CAN_Baudrate_calculs.xls
      file.
  
Directory contents 

  - CAN/Networking/system_stm32f2xx.c   STM32F2xx system clock configuration file
  - CAN/Networking/stm32f2xx_conf.h     Library Configuration file
  - CAN/Networking/stm32f2xx_it.h       Interrupt handlers header file
  - CAN/Networking/stm32f2xx_it.c       Interrupt handlers
  - CAN/Networking/main.c               Main program

	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 


Hardware and Software environment 

  - This example runs on STM32F2xx Devices.

  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up 
    - Use LED1, LED2, LED3 and LED4 connected respectively to PG.06, PG.08, PI.09
      and PC.07 pins
    - Use KEY Push Button connected to PG15 
    - Connect a female/female CAN cable between at least 2 EVAL CAN connectors (CN10)
    - Depending on the CAN cell used, you have to configure the jumpers as follows:

       +-----------------------------------------------+
       |   Jumper    |    CAN1 used    |    CAN2 used  |
       +-----------------------------------------------+
       |   JP3       |       2-3       |       1-2     |
       |   JP10      |       2-3       |       1-2     |
       |   JP7       |       1-2       |       1-2     |
       |   JP9       |      fitted     |      fitted   |
       +-----------------------------------------------+