AT90CAN - sending Messages without IRQ

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At the moment, I send my CAN_messages with interrupts activated.
So, after send is complete, the irq-routine deactivates the MOb and anything is fine.

For some reasons, I woul like to have a fire-and-forget mechanism and I am wondering if it is okay to trigger the send process without irq activated and then simply to do nothing even if send is complete.
Therefore, the MOb would stay activated longer than the send process needs to.

Is this okay ?

I program like a man:
COPY CON: > firmware.hex

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are in uncharted waters here. It seems possible, but you are going to have to deal with the CANSTMOB.TXOK flag before you may re-use the MOb for anything else. It is also possible the Tx may fail and there may not be any TXOK if you want to re-use the MOb again. If you never were aware of any TXOK and you want to re-use the MOb, when you finally try and re-use it you may get a surprise and find out it is not available for re-use.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay. It was just an idea for a "fire-and-forget" technique.
In fact, there would be normally interrupt-triggered transmissions.

Would it be sufficient to first de-activate the MOb , then re-activate TX ?

I program like a man:
COPY CON: > firmware.hex

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If any CAN Data Frame Tx works the CANSTMOB.TXOK will automatically disable the Tx MOb. If the old MOb is still busy you could issue a disable command by setting CANPAGE and using CANCDMOB set to disable. But if the CAN hardware is currently using the CAN bus for this Tx, it will finish this CAN bus Tx, at the CAN baud rate, before it disables the Tx MOb.

If you are able to tolerate a possible disable delay, your software could disable the MOb.

You could use two MObs, where you disable the old active MOb Tx then issue a new Tx using the other CAN MOb. This should avoid your program waiting on any one Tx MOb to complete a possible disable command. Of course if none of your Tx MObs ever complete, you would be constantly disabling the old failed Tx MObs, but something is wrong with your CAN bus if this is the case.