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.

Hercules CNCD SCI Problem - Follow On Question

Other Parts Discussed in Thread: HALCOGEN, MOTORWARE

I have a follow up question for the modified demo project SCI_UART_9600_RM48 for RM48 CNCD: I'm using the SCI Rx pin (DIMM 74) and while I can receive data without any problem in polling mode, I can't make the interrupt mode work: sciNotification() function or my interrupt function sciInterrupt() are not called by the code. I attached the files: sci.c/h, sys_vim.h, sys_main/startup.c, but to summarize, I did set sys_vim.h:

/* Interrupt Handlers */

extern void phantomInterrupt(void);
extern void esmHighInterrupt(void);
extern void phantomInterrupt(void);
extern void sciInterrupt(void);

sys_stratup.c:

static const t_isrFuncPTR s_vim_init[] =
{
    &phantomInterrupt,
    &esmHighInterrupt,        /*  0 */
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,        /*  5 */
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,
    &phantomInterrupt,        /* 10 */
    &phantomInterrupt,
    &phantomInterrupt,
    &sciInterrupt,        /* 13 */

...

----------

/* enable interrupts */
    vimREG->REQMASKSET0 = 1U
                        | (1U << 1U)
                        | (0U << 2U)
                        | (0U << 3U)
                        | (0U << 4U)
                        | (0U << 5U)
                        | (0U << 6U)
                        | (0U << 7U)
                        | (0U << 8U)
                        | (0U << 9U)
                        | (0U << 10U)
                        | (0U << 11U)
                        | (0U << 12U)
                        | (1U << 13U)

...

and sci.c:

sciREG->GCR1 = (1U << 25U)  /* enable transmit */
                  | (1U << 24U)  /* enable receive */
                  | (0U << 17)
                  | (1U << 5U)   /* internal clock (device has no clock pin) */
                  | (1U << 4U)  /* number of stop bits */
                  | (0U << 3U)  /* even parity, otherwise odd */
                  | (1U << 2U)  /* enable parity */
                  | (1U << 1U);  /* asynchronous timing mode */

    /** - set baudrate */
    sciREG->BRS = 12U;  /* baudrate */

    /** - transmission length */
    sciREG->FORMAT = 8U - 1U;  /* length */

    /** - set SCI pins functional mode */
    sciREG->FUN = (1U << 2U)  /* tx pin */
                 | (1U << 1U)  /* rx pin */
                 | (0U);  /* clk pin */

    /** - set SCI pins default output value */
    sciREG->DOUT = (0U << 2U)  /* tx pin */
                  | (0U << 1U)  /* rx pin */
                  | (0U);  /* clk pin */

    /** - set SCI pins output direction */
    sciREG->DIR = (0U << 2U)  /* tx pin */
                 | (0U << 1U)  /* rx pin */
                 | (0U);  /* clk pin */

    /** - set SCI pins open drain enable */
    sciREG->ODR = (0U << 2U)  /* tx pin */
                 | (0U << 1U)  /* rx pin */
                 | (0U);  /* clk pin */

    /** - set SCI pins pullup/pulldown enable */
    sciREG->PD = (0U << 2U)  /* tx pin */
                | (0U << 1U)  /* rx pin */
                | (0U);  /* clk pin */

    /** - set SCI pins pullup/pulldown select */
    sciREG->PSL = (1U << 2U)  /* tx pin */
                 | (1U << 1U)  /* rx pin */
                 | (1U);  /* clk pin */

    /** - set interrupt level */
    sciREG->SETINTLVL = (0U << 26U)  /* Framing error */
                       | (0U << 25U)  /* Overrun error */
                       | (0U << 24U)  /* Parity error */
                       | (0U << 9U)  /* Receive */
                       | (0U << 8U)  /* Transmit */
                       | (0U << 1U)  /* Wakeup */
                       | (0U);  /* Break detect */

    /** - set interrupt enable */
    sciREG->SETINT = (0U << 26U)  /* Framing error */
                    | (0U << 25U)  /* Overrun error */
                    | (0U << 24U)  /* Parity error */
                    | (1U << 9U)  /* Receive */
                    | (0U << 1U)  /* Wakeup */
                    | (0U);  /* Break detect */

...

-----------

#pragma INTERRUPT(sciInterrupt, IRQ)

void sciInterrupt(void)
{

...

Thanks,

Asa

SCI_UART_9600_RM48.zip
  • Hi Asa,

            Thanks for your post. We will look into your project and get back to you later. 


    Best Regards,
    Shelford

  • Hi Asa,

      I don't have RM48 CNCD board on hand now. I do a code SCI interrupt example code for RM48 USB stick :

     4118.RM48_SCI_Interrupt.zip

    You can take this as a reference for you codes.  I suggest you to keep HALCoGen project format , so it will help us a lot to read and understand your codes. Thanks.

    Best Regards,

    Shelford

  • I finally found the problem, it seems I should have placed the interrupt function at the 64th channel of vmi, as it is placed by Halcogen. However, now I have another question: I want to use DMA for SCI, however I can't find any source about this module (neither at Halcogen or Motorware) and I can't access the example code at http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/199989.aspx .