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.

Trouble getting SCIA interrupts to fire on F28335.

I have an F28335 controlCard with docking station.  The card has a UART connected to SCIA.  I have successfully communicated with it using the sci_echoback example code, but I haven't been able to use interrupts to control the operation of the serial port.  When I set up the example to use interrupts, the interrupts never fire, and no communication occurs.  I tried running the scia_loopback_interrupts example code, but it never seemed to do anything, watched variables never changed, so I don't think it was working right either.  I can't figure out what I am doing wrong.

Thanks,

Bob Baker

  • Robert,

    could it be that your baud rate is not set correctly?  Please recall that the 28335ControlCard currently comes with a 20Mhz external clock. This usually leads to a SYSCLK of 100MHz and a LSPCLK of 25Mhz, compared with 37,5Mhz on a 150MHz system. The loopback example will not discover a wrong data rate since both Tx and Rx will use the same.

    Regards

     

  • Frank,

    Thanks for the reply.   I think I have already worked through all the clock issues.  Here is how I have it set up.

    OSCCLK=20E6

    DIVSEL=3       //     Divide by 1

    PLLCR=7       //      Multiply by 7

    SYSCLKOUT=140E6

    LOSPCP=2         //   Divide by 4

    LSPCLK=35E6

     

                LSCLK

    BRR=--------------------       -1

               BAUDRATE*8

     

    The sci_echoback example sends chars to SCIA and listens for a reply all in main(), using no interrupts.  I have run this and got it working successfully.  I just don't seem to be able to implenent the interrupts for the Xmt and Rcv.

     

        EALLOW; // This is needed to write to EALLOW protected registers.
        PieVectTable.SCIRXINTA = &sciaRxFifoIsr;
        PieVectTable.SCITXINTA = &sciaTxFifoIsr;
        EDIS;   // This is needed to disable write to EALLOW protected registers.
        IER |= M_INT9;             // SCITXINTA and SCIRXINTA.
        // Enable the PIE.
        PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
        // Enable interrupts required for this example.
        PieCtrlRegs.PIEIER9.bit.INTx1 = 1;   // PIE Group 9, INT1.
        PieCtrlRegs.PIEIER9.bit.INTx2 = 1;   // PIE Group 9, INT2.
     // Enables PIE to drive a pulse into the CPU.
        PieCtrlRegs.PIEACK.all = 0xFFFF;
        EINT;
        ERTM;   // Enable Global realtime interrupt DBGM.

    When I send a char from PC to controlCard, the Rcv interrupt (sciaRxFifoIsr) never fires.  When I send chars to the PC, the Xmt interrupt never fires.

     

    Thanks for the help.

    Robert Baker

  • Robert,

    I suspect that your setup will run at 20MHz SYSCLKOUT frequency. Compare with sprufb08 (System Control and Interupts) table 3-9. If you select divsel =3,  as mentioned in your last posting, the PLL will be bypassed. In this case the command to set the PLL ratio to 7 (PLLCR =7) will not change the output frequency, it will stay at 20MHz. Compare also table 3-8.

    I personally use the 28335ControlCard with the external 20MHz oscillator and a setup of divsel = 2 and PLLCR.bit.div = 0xA to get a SYSCLKOUT 0f 100 MHz. Based on this frequency a SCI-communication with Interrupts and/or FIFO features is working fine.

    Regards

    Frank Bormann 

     

  • Frank,

    I tried your setup just to be sure and I get the same results, works fine when main() sends and receives the characters, but interrupts don't fire.

    I still think the way I had the clocks set up was valid.  I looked at the XCLKOUT signal directly with an oscilloscope.  Pin A10 has a via that you can access on the back of the board.  When I look at that pin I see a 35 MHz clock, which I would expect with this setup:

        // XTIMCLK = SYSCLKOUT/2
        XintfRegs.XINTCNF2.bit.XTIMCLK = 1;
        // XCLKOUT = XTIMCLK/2
        XintfRegs.XINTCNF2.bit.CLKMODE = 1;
        // Enable XCLKOUT
        XintfRegs.XINTCNF2.bit.CLKOFF = 0;

    With SYSCLKOUT set to 100 MHz I see a 25 MHz clock signal on A10.

    Thanks for the help.

    Robert Baker

  • I'm using a F28023 and seeing the same results as Robert.

    Sending/receiving via UART without using the FIFO is working fine when interrupts are polled, but interrupts are not being sent to the PIE.

    This is not a problem when using the FIFO. UART interrupts are sent to the PIE when the FIFO is enabled.

    Russ

     

  • Russ,
     
    When FIFO is disabled, transmit interrupt occurs whenever the data in the SCITXBUF register is transferred to the TXSHF register, indicating that the CPU can write to SCITXBUF; this action sets the TXRDY flag bit and initiates an interrupt.  
     
    So, for the first transmit interrupt to occur, data has to be written to SCITXBUF.  In your code, did you write any data to SCITXBUF before you expect for an interrupt?
     
    Thanks and Regards,
    Vamsi

     

  • Hi Robert.

    I am using F28035 and  have the same problem with interrupts on SCI as you . How did you solve this problem?

    Thanks for the help.

    Juraj Stredansky

  • Juraj,

    the previous post from Vamsi gave the correct answer regarding SCI - Interrupts:

    If you  operate with a disabled TXFIFO a TX-Interrupt is requested after you have written a first character in TXBUF and this character is moved (by internal hardware) to the shift register TXSHF. Which means that you have to load the first character let's say from main into TXBUF. All following characters can be loaded with each interrupt service routine call.

    If you enable TXFIFO and set the TXFIFO-interrupt level to zero, this condition becomes true immediately after you enable the SCI-unit (assuming that the TX FIFO filling status is in its initial condition, which is also zero). In this case a TX-Interrupt is requested immediately. You can load all your characters, including the first one, by means of the interrupt service routine. Thanks to the TXFIFO you can load a block of 16 characters to TXBUF within one single service.  

    Regards

     

  • Frank,

    I set breakpoint to interrupt service routine and start executing main program which load character into the TXBUF register, but program never hits the breakpoint. Even the TXRDY flag doesn't goes low after character is writen to TXBUF. Could by something wrong in register settings?

     

    This is setting for SCI:

    SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback
                                       // No parity,8 char bits,
                                       // async mode,

     SciaRegs.SCICTL1.all =0x0063;  // enable TX, RX,

     SciaRegs.SCIHBAUD    =0x0000;  // 9600 baud @LSPCLK = 15MHz (60 MHz SYSCLK).
     SciaRegs.SCILBAUD    =0x00C2;// Disable RX ERR, SLEEP, TXWAKE
     SciaRegs.SCICTL2.bit.TXINTENA =1;
     SciaRegs.SCICTL2.bit.RXBKINTENA =1;

     

    and this is enabling interrupts:

     DINT;

       InitPieCtrl();

       IER = 0x0000;
       IFR = 0x0000;

       InitPieVectTable();

     EALLOW;
     PieVectTable.SCITXINTA = &scitxinta_isr;
     PieVectTable.SCIRXINTA = &scirxinta_isr;
     EDIS;

     scia_echoback_init();  // Initalize SCI for echoback
      IER |= M_INT9;

       PieCtrlRegs.PIEIER9.bit.INTx1 = 1;
       PieCtrlRegs.PIEIER9.bit.INTx2 = 1;
     

       EINT;   // Enable Global interrupt INTM
       ERTM;   // Enable Global realtime interrupt DBGM

    Is there anything wrong?

    Thank you for help.

    Juraj

  • What is the purpose of your function call "scia_echoback_init()? Is it the call of the init lines at the beginning of your last post, or do you call something else here?

    How did you setup the GPIO's?

    What about the Clock control register PCLKCR0? Did you enable the SCI-A clock?

    I have added an working example for SCI-Transmit interrupts. It is based on the 28335 but you can easily adapt this for the Piccolo.

    Regards