EmbDev.net

Forum: DSP TriCore MultiCAN Transmit FIFO Problem.


von gapsna (Guest)


Rate this post
useful
not useful
Hi everyone, I've ben trying to transmit a FIFO Structure via CAN with 
my TriCore DSP but I#ve been stuck for the past few days and can't find 
the problem.

I use a modified version of the CAN_ubWriteFIFO function generated with 
Dave.
1
uint8 TRANSMIT_FIFO_V2(uint8 OB_FIFO, uint8 size, CAN_SWObj *pstObj)
2
{
3
  uint8
4
  retrn = 2;
5
  //////////////////////// CONFIGURATION OF THE SLAVES
6
  uint8 i,j;
7
  uint32 tmp_u32;
8
  uint8 aubFIFOWritePtr[128], ubFIFOReadPtr[128];
9
  for(i=OB_FIFO+1; i<= OB_FIFO+size; i++)
10
  {
11
    tmp_u32 = 0x1000000*PCAN_LIST_NR;
12
    tmp_u32 += (i << 16);
13
    tmp_u32 += 0x2;  //Command
14
    SetListCommand(tmp_u32); //////// ALOCATING EACH SLAVE TO THE SAME LIST
15
    CAN_HWOBJ[i].uwMOFCR = (3);//MMC = 0011
16
    CAN_HWOBJ[i].uwMOFGPR = (0x00FF0000)&(OB_FIFO<<16); // SLAVE CUR must point to BASE OBJ
17
    CAN_HWOBJ[i].uwMOCTR = (1<<27)|(1<<24)|(1<<25)|(1<<23)|(1<<21)|(1<<19)|(1<<19);// SET DIR, TXRQ, TXEN0, RXEN, MSGVAL, NEWDAT, RESET TXEN1
18
  }
19
  //////////////////////// END CONFIGURATION OF THE SLAVES
20
  //////////////////////// BASE OBJECT CONFIGURATION
21
  CAN_HWOBJ[OB_FIFO].uwMOAMR = 0;// no mask
22
  CAN_HWOBJ[OB_FIFO].uwMOFCR = (2)|(1<<27);//MMC = 0010+ DCL=8
23
  CAN_HWOBJ[OB_FIFO].uwMOFGPR = ((OB_FIFO + size)<<24)|((OB_FIFO)<<16)|((OB_FIFO + size)<<8)|((OB_FIFO));// SEL + CUR + TOP + BOT
24
  CAN_HWOBJ[OB_FIFO].uwMOCTR = (1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<21)|(1<<19);// SET DIR, TXEN0, TXEN1, RXEN, MSGVAL, NEWDAT
25
  //////////////////////// END BASE OBJECT CONFIGURATION
26
27
  //////////////////////// START TX FIFO TRANSMIT ACCORDING TO CAN_ubWriteFIFO() FROM DAVE, INFINEON
28
  if((CAN_HWOBJ[OB_FIFO].uwMOFCR & 0x0000000F) == 0x00000002) // IF OB_FIFO IS A TX FIFO BASE OBJECT
29
  {
30
    j = OB_FIFO;
31
    retrn = 0;
32
    if((CAN_HWOBJ[j].uwMOCTR & 0x00000100) == 0x00000000)// IF TXRQ == 0
33
    {
34
35
36
        CAN_HWOBJ[j].uwMOCTR  = 0x01280000;// set TXRQ, NEWDAT, MSGVAL
37
        retrn = 1;
38
     }
39
  }
40
  return(retrn);
41
}

Before calling this function I save the 8 byte Data and the ID in every 
Slave Object and in the Base Object.
After calling the function, It only sends the Data that is saved in the 
Base Object (I also happens if the Base Object is not part of the FIFO) 
with it's ID. CUR pointer of the Base Object moves to the next slave (in 
this case 0x68, beeing the Base Object the 0x67) but the data in the 
next slave object won't be transmitted. MOCTR Register of every Slave 
object is in following state: 0xYYZZ8BA8 (beeing YY and ZZ bytes for 
last and next object on the same list).

Any help would be apreciated.

Thank you all.
Vielen Dank.

Gapsna

von gapsna (Guest)


Rate this post
useful
not useful
SOLVED!!!!!!!!!!!

Problem was, that the PIR field in the MOAR Register of each slave had a 
value of 00b, I changed it to 01b and the FIFO works perfect!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.