TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137089 times)
  2. FAT32 Library (70232 times)
  3. Network Ethernet Library (56098 times)
  4. USB Device Library (46434 times)
  5. Network WiFi Library (42053 times)
  6. FT800 Library (41383 times)
  7. GSM click (29111 times)
  8. mikroSDK (26560 times)
  9. PID Library (26489 times)
  10. microSD click (25486 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

CAN Receive Demo

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.0.0.4

mikroSDK Library: 2.0.0.0

Category: CAN

Downloaded: 32 times

Not followed.

License: MIT license  

The application demonstrates CAN receive functionality.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "CAN Receive Demo" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "CAN Receive Demo" changes.

Do you want to report abuse regarding "CAN Receive Demo".

  • Information
  • Comments (0)

mikroSDK Library Blog

CAN Receive

Code developed on UNI-DS v8 and it can be used on other MIKROE development boards as well. Code was developed with purpose of easier understanding Controller Area Network Interface (CAN) receive functions.



Code description

This is a simple example that utilizes mikroSDK 2.10 CAN driver library. We recommend using this demo with CAN Transmit Demo. In this demo MCU receives data using Normal CAN Mode. Default configuration for receiving data is set to receive data from another CAN node, configured with CAN Transmit Demo. In this Demo it is expected to receive 3 data bytes where the first and the third bytes are constant and the second byte is an 8-bit value incremented with each reception and displayed on the port defined as TEST_PORT macro.


Hardware Support

This code was developed on UNI-DS v8 board. For this hardware to work according to program, you will need the following:

  1. Two boards and two MCUs.
  2. Twisted wire - around 30cm of it
  3. MCU cards with CAN connectors (or boards with on-board CAN connectors, such as EasyPIC v8)
    • easypic_v8_can_connector
    • image
  4. Alternatively, instead of soldering additional connectors to your existing MCU cards, you could use CAN-1 Boards

Note: You might need terminal resistence (aproximately 120 Ohms). This is hardware dependent.

To connect everything properly, follow these steps:

  1. Connect CAN connectors with twisted wire. CANH and CANL on one board are connected to CANH and CANL on the other one respectively.
  2. If terminal resistance is needed, put a through-hole resistor in one of the connectors (between CANH and CANL of the same connector).
  3. If using CAN-1 Boards, place them on adequate headers on boards.

Software Support

We provide code for demonstrating the usage of functions contained in CAN driver library. To run this example, follow these steps:

In order to make this example work, proper clock setup is needed. To create a setup with the adequate clock scheme, follow these steps:

  1. Install the package from Package manager.
  2. Open example.
  3. It will take you to setups, so make one for your hardware.
  4. Choose adequate setup and clock configuration and the project will open.
  5. Define test port using TEST_PORT macro and test pins using TEST_PIN_x macros according to your hardware.
  6. Program it by clicking on Flash.
  7. Once CAN Receive Demo is programmed and the two boards are connected properly, data should be visible on it on the defined port. Use a logic analyzer to see the signals.
  8. If transfer completes successfully, TEST_PORT will display received value.
  9. If nothing is happenning reset your transmitter board.

ALSO FROM THIS AUTHOR

4x4 RGB click

0

4x4 RGB click is a matrix of 16 intelligent RGB elements, forming a 4x4 display screen.

[Learn More]

Driver 2 click

0

Driver 2 Click is a compact add-on board that contains a gate driver with a level-shift technology with an additional Shutdown function. This board features the IR2104S, a high voltage, high-speed power MOSFET and IGBT driver with typical 0.21 A source and 0.36 A sink currents and independent high and low side referenced output channels from Infineon Technologies.

[Learn More]

Thermo 2 click

5

Thermo 2 click carries DS1825, a programmable resolution digital thermometer IC. It measures temperature within a range from –10°C to 85°C with ±0.5°C accuracy.

[Learn More]