Flow control selection in S12xDp512 Controller

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flow control selection in S12xDp512 Controller

714 Views
santhoshsl
Contributor III

Hello All

 

I am trying to interact with SIM300 GSM modem from my s12xDp512 controller.

For which in SIM 300 manual it is written that flow control of the host should be None. Where as in S12x board I am seeing it has "Xon/Xoff" as flow control.

 

Can you please let me know how can I change Flow control setting of S12x board?

Labels (1)
Tags (2)
0 Kudos
3 Replies

477 Views
GordonD
Contributor IV

What S12XDP512 board do you have and what firmware is running on the board?

Best Regards,

Gordon

0 Kudos

477 Views
santhoshsl
Contributor III

Hello Gordon,

Thanks for your mail. Here are the required inputs.

Controller is S12XDP512. I am using HCS12X starter Kit. Board is configured to use 16Mhz crystal and running sci at 9600baud rate.

Currently controller has as simple code to send AT command to SIM300 board and check for OK response.

Attached is the project for this task

0 Kudos

477 Views
GordonD
Contributor IV

Santhosh,

Removing the Xon/XOff flow control would make the Rx and Tx ISRs look like:

/*************************************************************************************/

void RxISR(void)

{

 

/* Variable Declarations */

uchar c;

/* Begin Function RxISR() */

c = SCI0DRL;

if (RxBAvail != 0) /* if there are bytes available in the Rx buffer */

  {

   RxBAvail--; /* reduce the count by 1 */

   RxBuff[RxIn++] = c; /* place the received byte in the buffer */

   if (RxIn == RxBufSize) /* reached the physical end of the buffer? */

    RxIn = 0; /* yes. wrap around to the start */

  }

 

} /* end RxISR */

/*************************************************************************************/

void TxISR(void)

{

 

/* Variable Declarations */

/* Begin Function TxISR() */

 

   SCI0DRL = TxBuff[TxOut++]; /* remove a character from the buffer & send it */

   if (TxOut == TxBufSize) /* reached the physical end of the buffer? */

    TxOut = 0; /* yes. wrap around to the start */

   if (++TxBAvail == TxBufSize) /* anything left in the Tx buffer? */

    SCI0CR2 &= ~SCI0CR2_TIE_MASK; /* no. disable transmit interrupts */

   }

 

} /* end TxISR */

/*************************************************************************************/

The get char() and put char() functions would look like:

/*************************************************************************************/

int putchar(int c)

{

 

/* Variable Declarations */

/* Begin Function putchar() */

while (TxBAvail == 0) /* if there's no room in the xmit queue */

  ; /* wait here */

DisableInterrupts;

TxBuff[TxIn++] = c; /* put the char in the buffer, inc buffer index */

if (TxIn == TxBufSize) /* buffer index go past the end of the buffer? */

  TxIn = 0; /* yes. wrap around to the start */

TxBAvail--; /* one less character available in the buffer */

EnableInterrupts;

return(c); /* return the character we sent */

  

} /* end putchar */

/*************************************************************************************/

int getchar(void)

{

 

/* Variable Declarations */

uchar c; /* holds the character we'll return */

/* Begin Function getchar() */

while (RxBAvail == RxBufSize) /* if there's no characters in the Rx buffer */

  ; /* just wait here */

DisableInterrupts;

c = RxBuff[RxOut++]; /* get a character from the Rx buffer & advance the Rx index */

if (RxOut == RxBufSize) /* index go past the physical end of the buffer? */

  RxOut = 0; /* yes wrap around to the start */

RxBAvail++; /* 1 more byte available in the receive buffer */

EnableInterrupts;

return(c); /* return the character retrieved from receive buffer */

  

} /* end getchar */

/*************************************************************************************/

Best Regards,

Gordon

0 Kudos