Loading ...
Sorry, an error occurred while loading the content.

UART + SPI problem

Expand Messages
  • leovin4i
    Hello, I have a problem with the ADuC7026. Here is a part of my code __irq __arm void cv_irq_handler(void) { u32 RxBuf; RxBuf = COMRX; // read data and clear
    Message 1 of 2 , Jun 3, 2006
    • 0 Attachment
      Hello,
      I have a problem with the ADuC7026. Here is a part of my code

      __irq __arm void cv_irq_handler(void)
      {
      u32 RxBuf;
      RxBuf = COMRX; // read data and clear interrupt
      COMTX = RxBuf; // loop data back

      if(cnt == 9)
      {cnt ^= cnt;}
      else cnt++;
      sendSysMsg(5);
      }

      void main (void)
      {
      for(;;)
      {
      Write_Spi(cnt);
      }
      }

      The program is very simple:
      When the UART recieve charracter it sends it back and increment cnt.
      If cnt == 9 it is cleared. The sendSysMsg(5) sends the "[IRQ_HANDLER]"
      message via the UART.
      The whole thing worked fine untill i added the Write_Spi(); function
      in the main loop.
      Then the data that is sent in the irq handller is corrupted. =>
      æ[ÉRQ_HANDLÅRÝ
    • kianwang
      Howdy, What is your UserCode/FIQ/IRQ stack size? These can be found in the linker scripts which depend on which compiler you are using. Try increasing these
      Message 2 of 2 , Jun 6, 2006
      • 0 Attachment
        Howdy,

        What is your UserCode/FIQ/IRQ stack size? These can be found in the
        linker scripts which depend on which compiler you are using.

        Try increasing these and try again.

        For example, the default values in the IAR compiler are very small and
        should be increased to ~ 0x200.

        --- In ADuC_ARM@yahoogroups.com, "leovin4i" <leovin4i@...> wrote:
        >
        > Hello,
        > I have a problem with the ADuC7026. Here is a part of my code
        >
        > __irq __arm void cv_irq_handler(void)
        > {
        > u32 RxBuf;
        > RxBuf = COMRX; // read data and clear interrupt
        > COMTX = RxBuf; // loop data back
        >
        > if(cnt == 9)
        > {cnt ^= cnt;}
        > else cnt++;
        > sendSysMsg(5);
        > }
        >
        > void main (void)
        > {
        > for(;;)
        > {
        > Write_Spi(cnt);
        > }
        > }
        >
        > The program is very simple:
        > When the UART recieve charracter it sends it back and increment cnt.
        > If cnt == 9 it is cleared. The sendSysMsg(5) sends the "[IRQ_HANDLER]"
        > message via the UART.
        > The whole thing worked fine untill i added the Write_Spi(); function
        > in the main loop.
        > Then the data that is sent in the irq handller is corrupted. =>
        > æ[ÉRQ_HANDLÅRÝ
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.