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.

Problem writing some ecan registers in a 28069M when modifying a motorware Lab

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE

I know my code below does not fit with the normal style of code for the motorware labs but I think it should work.
I'm trying to initialise the Ecana peripheral in a 28069M and I think I've added all the required code, but one section is not working correctly
    ECanaMboxes.MBOX0.MSGID.all = 0x00040000; //receive standard ID 00000000001
    EcanaRegs.CANME.all = 0; //disable all mailboxes
    EcanaRegs.CANMD.all = 0xFFFFFFFF; //all mailboxes to receive for now
    EcanaRegs.CANME.all = 0x1; //enable mailbox 0
    //ECanaShadow.CANME.all = EcanaRegs.CANME.all;
    //ECanaShadow.CANME.bit.ME0 = 1; //enable mailbox 0
    //EcanaRegs.CANME.all = ECanaShadow.CANME.all;
    asm(" EALLOW");
ECanaRegs.CANMIM.all = 0xFFFFFFFF; //Mailbox interrupt mask register. All 32 rx and tx interrupts enabled
ECanaRegs.CANGIM.all = 0x0000FFFF; //enable global CAN interrupts
    asm(" EDIS");


The first line writes the correct value to the MSGID register OK, but lines 3 and 4 refuse to write to the CANMD and CANME registers. I think CANGIM has the same problem, whilst CAMIM writes ok. 
I tried the example Back2Back program and that works fine writing these registers, so I'm guessing I must be doing something wrong in the sequence of writing them, but I've no idea what.
Can anyone suggest what the problem might be ?
Thanks,
Geoff
  • Geoff,

    The thing that comes to mind here is register protection.  I looked it up and I don't think CANMD or CANME have EALLOW protection on them, but we've had errors in our documentation before.  Could you try putting an EALLOW; before this code and see if the writes go through?

    BR,

  • No luck I'm afraid Trey,

    I tried putting an EALLOW, or as it's done in the motorware program "asm(" EALLOW");", but it makes no difference.

    I then tried changing the values of CANME and CANMD using the EcanRegs in the Expressions window to just any random value and this worked. Then I checked the actual register values in the Registers window and they had also changed to the values I typed in.

    I was sceptical that the EALLOW would work because as you say, the documentation doesn't say you need to do this, but more importantly, when I run the ControlSuite Example_2806xECanBack2Back on the same hardware (a 69M-KIT board) the registers write successfully.

    Looking at that program, the last line in the InitECana()  function, which comes before CANME and CANMD are written, is an EDIS. Following that there are no EALLOW statements before the CANME and CANMD are written.

    So, it's still a bit of a mystery.

    I can try to send you my whole project folder if you like, but do I need to email this rather than attaching it to a post, where it would be public ?

    Best Regards,

    Geoff

  • Geoff,

    Hrmmm....that's very interesting.  The addresses that the CPU is using for these registers are generated from the same information which is used for the expressions window, while the registers view comes from a separate XML file in the CCS installation.  The fact that you're able to correlate these means the addresses the CPU is trying to access are correct.

    Debugger reads/writes are slightly different from CPU read/writes, but the CPU should still be able to write to those.

    Its up to you if you want to post a project on here.  If you do it will be public, so don't post any sensitive IP.  If you add me as a friend on e2e I can send you a private message with my email address.

    BR,

  • Hi,

    is there any update on this? (and in eCAN support in MotorWare in general?)

    I am about to start developping a Motorware application that needs CAN and so far I have come to the conclusion that the best place to start is to port the ControlSuite code (F280Yx_ECan.[ch]) to MotorWare. Is there a better alternative?

  • Hi Giannis,

    I did get the ecan working with some help from TI. In the end I'd made a couple of mistakes with a declaration on the ecan registers, as far as I can remember, although I'd have to do a bit of searching to find out what the exact mistake was.

    As far as I'm aware, TI haven't done a motorware ecan.c file, so you have to produce your own. I found that was quite a job, but maybe my programming skills aren't that good. As you may already be aware, the ContolSuite and Motorware styles of coding are very different.

    I started with the ControlSuite example and did end up with a working ecan peripheral in motorware.

    Hope that's some help.

    Geoff