Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > 68013A (128 pin) and USART0 Rx&TX Interrupts

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



68013A (128 pin) and USART0 Rx&TX Interrupts
Moderator:
RSKV

Post Reply
Follow this topic



68013A (128 pin) and USART0 Rx&TX Interrupts

FMOptikon posted on 25 Jul 2012 7:08 AM PST
Member
4 Forum Posts

 

Hi,

I'm using this uC to control a RS232 port. I enabled the interrupt

and I can read a received payload of 3 bytes by a vendor command and an interrupt routine.

I have problem when I try to write because I suppose the interrupt routine is triggered, something goes wrong and the 

uC won't answer. Could you help me?

How do I manage the writing operation skipping the interrupt?

 

This in the TD_Init:

 CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ; //Setting up the clock frequency

SYNCDELAY;

 T2CON = 0x34 ;

RCAP2H  = 0xFF ;

RCAP2L = 0xD9;

SCON0 = 0x5A ;

 Cont=0;

IE|= bmBIT4;

 

The interrupt routine:

#include "fx2.h"

#include "fx2regs.h"

#include "fx2sdly.h"            // SYNCDELAY macro

extern BYTE Cont;

extern BYTE rbuf[10];

void IRS_USART0(void) interrupt 4

{

if (RI != 0)

  {

  RI = 0;

  *(rbuf+Cont)=SBUF0;

  Cont++;

  if(Cont==3)

  Cont=0;

 }

else if(TI!=0)

     TI=0;

}

 
THE VENDOR COMMAND 
case V_READING:

while (TI == 0) ;

TI = 0 ;

SBUF0 = ch ;

break;

 




Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

PRJI posted on 25 Jul 2012 11:33 AM PST
Cypress Employee
333 Forum Posts

 Hi,

 Try this 

 if(TI)

         {

 

if (n<=9)

      {

           SBUF0=EP2FIFOBUF[n];

           TI=0;

           n++;

      }

else

    {

            TI=0;

             n=0;

    }

}

Thanks

Prajith

 



Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

FMOptikon posted on 27 Jul 2012 12:24 AM PST
Member
4 Forum Posts

 Hi, thx for your suggestion

but I need to test that in the vendor command

or in the interrupt routine?



Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

PRJI posted on 27 Jul 2012 03:16 AM PST
Cypress Employee
333 Forum Posts

 

     In Interrupt Service Routine.



Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

FMOptikon posted on 27 Jul 2012 07:24 AM PST
Member
4 Forum Posts

 Ok,

but it's not clear how the uC manages the communication.

In RX I HAVE NOT problem.... because it's clear... for each BYTE I've an interrupt,

and I'll store the byte in a buffer and when the buffer will be complete I'll have my payload

(eventually I'll introduce a preamble and CRC...) 

 

But If I want to transmit a payload received by a Vendor Command

why I need to use the Interrupt?

It has no sense for me.

 

So with your example I need to write n>0in a correspondig vendor Command  to trigger the interrupt?

And only in the interrupt routine I'll write with SBUF=something?

Bye

 



Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

PRJI posted on 30 Jul 2012 03:33 AM PST
Cypress Employee
333 Forum Posts

 Hi,

  You can do it either using interrupt as explained in http://www.cypress.com/?id=4&rID=55681 or by checking endpoint buffer flags as in http://www.cypress.com/?rID=40248.

Thanks

Prajith



Re: 68013A (128 pin) and USART0 Rx&TX Interrupts

FMOptikon posted on 31 Jul 2012 05:42 AM PST
Member
4 Forum Posts

I'm going to study this examples.

Thx for you help!!!






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20