This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CAN Communication



Hello,

I am inquiring on whether or not I can make my tm4c123g launchpad a listener and a talker on the CAN Bus.

Is CAN limited to one single listener and one single talker?

Purpose of launchpad:

To receive data from a manager 

To send "hello" data to the manager every 1/10 of a second

Respectfully,

Alex

  • alex gonzalez said:
    I am inquiring on whether or not I can make my tm4c123g launchpad a listener and a talker on the CAN Bus

    Yes

    alex gonzalez said:
    Is CAN limited to one single listener and one single talker?

    No it is a bus structure and allows multiple devices. There must be more than one device on the bus.

    There are many CANBus introductions available. It will be worth your while (and ours) for you to read them.

    Robert

  • As poster Robert describes there are (even) code examples which (well) illustrate the set-up & configuration of CAN peripherals for transmit and receive.

    Code examples, "simpleCan_RX & simpleCan_TX have been used w/success by hundreds here. (to include this reporter)

    Be mindful that most always - a CAN xcvr and (real) CAN remote are required. (any time "saved" via loopback attempt will be quickly burned in delay & frustration - yours and (especially) hapless helpers!)
  • Hello cb1 & Robert,

    Understood have used the example code and they are for single transmissions and they work.

    To elaborate more on the subject matter is there anyway to avoid an error with debugging a code that is receiving messages and periodically sending hello messages to another device.

    It is in regards to the CANMessageSet ();//Whether it is RX or TX.

    The reason being I am receiving messages from a manager and I want to send him a verification that message was received, but having trouble.
    Issue 1: I can receive messages (data) from the manager, but I cannot speak to the manager

    Issue 2: I can send message (data) to the manager, but can no long receive messages from the manager.

    Issue 3: Neither will work which halt communication between the two devices.

    It has something to do with the CANMessageSet() line and its placement in the code.

    I will be attaching the code (in the next 30 minutes) that I am using with notes which will highlight the conditions for the aforementioned issues.

    Respectfully,
    Alex

  • Acknowledge your posting - yet it's bit "late today" & best we read fresh - try to respond tomorrow.

    Perhaps it is me - or the hour (time) but I cannot be sure if your, "Three Cases" are (real) or theoretical. Please explain.

    As for usage - we've sent hundreds of messages via Simple_TX - received via Simple_RX - and (very) rarely had trouble.

    Usually switching to a lowered data rate will improve message robustness. You must employ proper communication cable - and keep the cable and each CAN-based MCU as far as possible from noise sources.

    From a software standpoint - I'd suggest testing w/the MCU very much (unloaded) and free to focus upon its CAN requirement. Once you've established a successful CAN link - then is the time for introducing added demands.