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.

2801 CAN not working

Hi,

I have two setups.  The first is a 2808 in a docking station.  CAN works perfectly.  The second is a 2801 in a target system.  CAN won't work at all (transmit or receive).

I checked the CAN input from my PCAN and have good data going in to the processor.  I checked the CAN output from the processor and it's garbage.  The waveforms are clean and 0 to 3.3V but the data pattern makes no sense (it's not CAN data).  The CAN data going in to the processor is a good CAN signal with the whole data stream taking about 800us (transmit/receive set at 125Kb/s).  The CAN signal going out of the processor goes high for about 200us, goes low for about 50us, goes back high for about 600us and then pulses high for about 50us every 800us.

Both processors have the same code with the exception that the 2808 is set up to run off the PLL and the 2801 is set up to run off a 100MHz clock on CLKIN (X1 grounded, X2 open).  I'm running out out of flash and the settings on the On-Chip Flash utility are:

OSCCLK =100

CLKINDV = 1

PLLCR Value = 0

I am only using functions common to both processors (i.e. CANa, PWM3, CAP2, etc.).

  • I just loaded the eCAN back2back example program into the 2801 downstairs.  I got the same results with the exception the 2801 CAN transmits nothing (rather than transmitting a bad CAN data stream).  The CAN won't transmit and the code gets stuck waiting for the transmit acknowledge signal.

     

    I just loaded the eCAN back2back example program into the 2808 upstairs and it works fine.  Transmits and receives.

  • Richard,

    looks like a hardware related problem with your 2801-target. Are you able to run other programs in the 2801, which do not use the CAN? If yes, do they run stable, e.g. for a longer time? I suspect (just a guess) that there is something wrong with the clock system (EMI, ground shift, etc). 

    Can you do the test also at a 2nd 2801-target?   In the past I used the 2801 in a customer-project for CAN -communication w.o. problems (however I used the PLL).

    Regards

     

  • The rest of the program runs.  I have put counters and flags in to make sure my program is actually running.  It just has no CAN communication.  I'm thinking I've set something up wrong but I'm not sure what it is.

    I agree it probably has to do with the clock as the 2808 system is running off the PLL and the 2801 is running off a 100MHz oscillator.  I've checked the CAN signal for noise but the signal going in to the processor is clean and looks to be a good CAN data stream.  The CAN transmit from the processor is clean but it is not a good CAN data stream.

    I've checked the oscillator signal going in and while it is not ideal (a little rounded off at the peaks), it is 100MHz, it is steady, and it should be getting squared up by the CMOS inside.

    I don't think this is a bug.  I just think I'm missing something on initialization configuration.  I could be missing something on the hardware configuration.

  • I have discovered more about this problem that might help in the solution.

    I ran my code to check on the other functions.  It appears that PWM3 is working with a difference from the design.  I'm using PWM3 to put out a 10KHz PWM but it's running at 5KHz.  I have a 2ms timer that controls my runtime to 100ms.  If I select 20 seconds, it runs for 40 seconds.  If I select 10 seconds, it runs for 20 seconds.

    This all works as designed when programmed into the 2808 development board.  I'm certain that this time change is the cause of my CAN not working.  Somewhere I'm getting divided by 2 when I program the 2801 but that doesn't happen when I program the 2808.

  • Richard,

    What frequency is the clock input to the 2808? And what is its scaling in the PLL? (i.e. what is the internal frequency)

    Tim

  • I believe the 2808 runs on an 20 MHz crystal on CLKIN plus the PLL.  Internal frequency is 100MHz.

    The set up to program the 2808 is:

    CLKINDIV = 1

    PLLCR = 10

    CPU_RATE = 10.000L

     

    Our 2801 runs on a 100MHz oscillator on XCLKIN with X1 Grounded and X2 open.

    The set up for the 2801 is:

    CLKINDIV = 1

    PLLCR = 0

    CPU_RATE = 10.000L

     

  • According to the F280x Sys Ctrl and Ints Guide (SPRU712G), Table 3-8 you are running your F2808 at 200MHz.  This is based on (input clock*10)/1.  Now either you have got the input crystal wrong (your use of the word believe indicates that you haven't double checked?) or you are overclocking it.  This would explain the difference in 2 (F2801 at 100MHz, F2808 at 200MHz).   There is a quick way to find out:

    What is the CAN speed? (125kbps?) and What is the CANBTC settings? BRPREG, TSEG1REG and TSEG2REG.  Since CAN comes directly off SYSCLKOUT you should be able to work out you SYSCLKOUT in the F2808 from the CAN speed and these values.

    If it does end up to be 200MHz, then I am very intrigued that you could be running it this fast with relatively few issues.

    Tim

  • Hi Tim,

    I'm running the 2808 using the sample code and headers provided by TI.

    I did just now solve my /2 problem though.  Their SysCtrl.c file was setting the CLKINDIV to 0 after I set it to 1.  After I fixed that, my clock is now 100MHz.  Unfortunately, it isn't why my CAN isn't working.  My CAN still doesn't receive or transmit.  I'll dig further into the CAN setup and see if I can find someplace else their code hosed me.

    LIke I said above, this code works perfectly in the 2808 but I don't get any CAN operation in the 2801.  I'll dig some more.

    Thanks,

    Rick

  • Have you got your CAN code handy?  I just wrote a CAN driver for the F28335 earlier this week so it is fresh in my mind.  Having a look at the F280x CAN, the code should be pretty much the same, so I may be able to assist in finding the problem.

    Tim

    Edit: What is your hardware setup for testing the CAN? Connection to a CAN network (or at least a driver chip)?

  • Richard,

    I re-read your initial post and had a brainwave.  I remember seeing that exact behaviour on my CAN circuit earlier this week.  I did not have a CAN driver and network handy so I was just basically reading the pinout.  And that behaviour occurred.  I ended up diagnosing it as the CAN transmitter not being able to see its own transmissions on the bus and thus thinking there is an arbitration issue (I fixed it by placing a header between TX and RX - a stopgap measure but the activity on the bus looked a lot better).  Have a look at your hardware and make sure there the path from the TX to the driver and back to the RX is intact.

    Hopefully this helps,

     

    Tim

  • Hi Tim,

    I think you're on to something.  I checked and indeed the transmission is not getting back to the receiver. 

    In my design, the transmit signal from the processor is high until transmit.  The signal comes out upside down.  Is that normal?  Also, my receiver signal to the processor is always high until I receive a CAN data stream which is right side up.  What should I be expecting at the processor for CANTX and CANRX?

    Thanks again, you've been an amazing help when I was in a pickle.

  • I am not 100% on the default nature of the pins except to say:

    a) Mine are default high (and I just got my little back to back CAN working).

    b) The TI code has the internal pullups enabled.

    c) Figure 1-2 of the eCAN guide hints that it starts off high and goes low for the start bit.

    But I haven't seen anything which says that confirms this.

    Tim

  •  The CAN - Interframe space is a 3.3V level at CAN-TX; the start bit (SOF) of a new frame is the first 0 - bit (0 Volt at CAN-TX).

    I have attached a screenshot of a logicanalyzer, which shows the Signal CAN_TX for a frame with standard ID = 0x100, 1 Byte payload (0x55) and a data rate of 100 kbit/s.

    Below is the description of all bitfields. The bits highlighted in yellow are stuffbits. 

  • Thanks Tim,

    Once again you've helped me solve my problem.  Nice brainwave.