Is this how the AT90CAN Mailbox plugin is supposed to look?

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

Hi, I downloaded and installed the
"AT90CAN128/64/32 Plugin 1.0.6 (for AVR Studio 4.12 or higher)"
http://www.atmel.com/dyn/products/product_card.asp?part_id=3795
I have AVR Studio 4.15.
See An attached pic of how the mail box looks for me.

I just cant come right with making it appear sensible. Is there anyway to make me appear logical? Or should I just abandon the idea of simulating with ATMEL? :shock:

Attachment(s): 

Just a noob in this crazy world trying to get some electrons to obey me.

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

I have no clue. It appears to show each MOb from index 0 to 14 in each row, but the column labels are trashed and the data appears to be trash. I only have CAN experience with conventional run time debugging and JTAGICE mkII debugging, which should be entirely more reliable than any simulation software.

If it wasn't for the trashed column labels I might suspect that maybe the MOb data needs to be initialized before displaying anything useful. However, the trashed labels suggest a much bigger more fundamental problem is afoot here.

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

Hi MikeB!
Dammit if I knew you were going to reply I would of posted a more meaningful question! I think it is my windows settings/version it doesnt like. When I click on changeable fields, then I can see the text (changes to like an edit box with larger font).

Maybe I would of asked something like...
I am struggling to understand the concept of sending Messages.
Say one sets up the first 5 Mobs (IDT, IDE, RTRTAG, DLC, RBnTAG, MSG)

How does one transmit those 5 Mobs. From the datasheet (19.5.2.2) it seems like its the setting of CONMOB is what starts the transmission. Does the setting of any Mob's CONMOB start transmission of the Mob with the Highest Priority?

So then to Transmit the 5 Mobs (with all of their CONMOBs set to TX), The Highest Priority Mob number must then be changed from 0 to 4, and after each successful transmission the CONMOB of any of those MOBS must be re-written to TX?

Thanks for any help! :oops:

Just a noob in this crazy world trying to get some electrons to obey me.

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

fever2tel wrote:
From the datasheet (19.5.2.2) it seems like its the setting of CONMOB is what starts the transmission.
Correct, the CONMOB bits are defined in the CANCDMOB description (19.11.2). This is why the entire MOb must be setup before its CONMOB bits are changed from the disable state.

The data sheet isn't really clear if the Highest Priority Tx Mob is the "MOb index number" or the "CANIDT message identifier value" priority. The Rx MOb priority is the "MOb index number", so I suspect the Tx MOb priority is also the same. When CONMOB is set to Tx, the corresponding CANEN register ENMOBn bit is set to indicate the MOb is not available. The CAN hardware will send whichever Tx MOb it wants to first, then the next and so on. After each MOb CANSTMOB register TXOK, the corresponding CANEN register ENMOBn bit is cleared. The MOb index numbers are not changed, each MOb enable availability status is simply cleared. Yes you must rewrite the CONMOB before that MOb will set the corresponding CANEN register ENMOBn bit and Tx another CAN frame again. Often the MOb setup data may be setup again from scratch, reused or modified before CONMOB is set again.

You just setup the Tx MObs, write the CONMOB bits and the CAN hardware takes care of all the rest. The CANSTMOB register TXOK or the CANEN register ENMOBn will tell you when the MOb is available for use again.

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

Thanks for the reply!!!
So If I want to send 5 Mobs, from what I understand from your above post is one would set up all 5 of them, then all 5 get transmitted, then the TXOK interrupt occurs.

What I am unsure about is if I set CONMOB of say the first Mob I want to send to TX, I imagine the CAN channel tries to send that one before I have re-set the other Mob's CONMOB to TX too! Then while its trying to send that first Mob, if I start setting the other 4 Mobs to TX again, and if I do it fast enough will it continue transmitting all the other Mobs before the TXOK interrupt occurs?

Am I allowed to edit the Message bits of a Mob that is in use as indicated by CANSTMOB?

If I enable a Mob to be TX during intialisation, then Enable the CAN Channel(ENASTB), will it try to transmit those Mobs for a first time, or do I have to re-write them to TX once the CAN channel is ready?

I cant tell you how much I appreciate you explanations! I have printed them out, and even made pdf compilations of them. 8)
You are a star!

Just a noob in this crazy world trying to get some electrons to obey me.

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

The TXOK occurs for each MOb just after it is sent. When you set CANPAGE = MOb index number and look at the CANSTMOB register for only that MOb, you will find the TXOK bit that belongs just to that MOb. No matter what order the MObs complete their Tx operation in, their own individual TXOK bit will be set when they complete. Unless you only setup and send one single Tx MOb at a time, the CAN hardware will decide for itself what order to send more than one Tx MOb. If each Tx MOb has a unique CANIDT message identifier, it will not matter what order they are sent in. If you are trying to force more than 8 bytes (the CANMSG maximum) in a specific byte order sequence using the same CANIDT message identifier through the CAN bus, then you should only use that specific message identifier MOb to Tx one group of CANMSG bytes (in order) at a time.

When a MOb CANEN register MOBENn bit is set to message object enabled, the CAN hardware may write to or use any enabled MOb memory anytime it sees fit, even when global interrupts are disabled. If you write to a MOb that is busy (enabled) your write could conflict with automatic CAN hardware reads or writes. When the TXOK happens the corresponding CANEN register MOBENn bit is cleared to message object disabled. It is the CANEN register that tells you if the MOb is busy. The CANSTMOB register only tells you the MOb completion state or if there are MOb related CAN bus errors. Do not write to the CANMSG bytes of any enabled (busy) MOb.

The CAN appears to be happy to automatically wait until the CANGSTA register ENFG is set before sending. So, you should be able to initialize the CAN hardware, set the CANGCON register ENASTB (enable the CAN), then setup Tx or Rx MObs without waiting for the CANGSTA register ENFG bit to set. Of course nothing will happen until after ENFG bit is set. You may setup any CAN Tx MObs anytime you like (always to a CANEN disabled not busy MOb) and the CAN hardware will take care of sending them and disabling each MOb as it finishes sending them (TXOK).

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

A big up yourself to you mike B. I just finished coding all my CAN stuff following your advice, and it works! Its 3 in the morning here and I can finally sleep, yay!!!!
Praise the Lord for Mike Bs!!
I think atmel should get you to write the CAN section of the datasheet!!

Just a noob in this crazy world trying to get some electrons to obey me.