mc56f8367

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

mc56f8367

2,517 Views
sasikumar_e
Contributor II

HI,

i want to code sci pins in MC56F8367 i did the initialization process but i cant fetch the input from sci pins please guide me

Tags (2)
18 Replies

2,245 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Sasi,

I think you can write the code as following, especially, I recommend you use a forever loop so that you can test the Txd0 pin signal

void SendChar()
{
    SCI0_SCIDR = 0x0061;
    while(!(SCI0_SCISR&0x8000))  {}
   // Tx = SCI0_SCIDR;
}

void RecvChar()
{
  SCI0_SCISR = 0x0000;
  while(!(SCI0_SCISR&SCI0_SCISR_RDRF) ) {}
  chr = Tx;
}

void main(void)
{
    SIM_PCE    = 0x0010;
    GPIO_E_PER = 0x0003;
    GPIO_E_DDR = 0x0001;
    SCI0_SCIBR = 391;
    SCI0_SCICR = 0x000C;
for(;;)

{
    SendChar();

}
    //RecvChar();
}

Then test the TXD0 pin to check if there is signal.

BR

XiangJun Rong

2,245 Views
sasikumar_e
Contributor II

Hi Xiangjun,

It worked, as per our assumption the code you provided contains a 16 bit value in the while condition is it necessary to provided 16 bit values in the conditional statement

0 Kudos

2,245 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Sasi,

Regarding the code:

void SendChar()
{
    SCI0_SCIDR = 0x0061;
    while(!(SCI0_SCISR&0x8000))  {}
   // Tx = SCI0_SCIDR;
}

when the Character transferred to Transmit Shift register, the TRDE bit in the SCI_SR become 1 immediately, so you have to poll the SCI_SR register constantly, no matter whether the SCI_SR register is 16 bits or 8 bits, it does not matter.

BR

Xiangjun Rong

0 Kudos

2,245 Views
gaya3citizen
Contributor II

Hi, how to initialize SCI in MC56F8367? Not found any example code, according to user manual we tried the following program, still got no result. Is there any registers left to initialize SCI

#include "MC56F8367.h"

unsigned int rx_out = 0;

int main()
{
SIM_PCE = 0x0020;

SCI1_SCIBR = 0x0062; //38400Baud
SCI1_SCICR = 0XA0AC;

while(!SCI1_SCISR_TDRE)
SCI1_SCIDR = 0X000b;

while(!SCI1_SCISR_RDRF)
rx_out = SCI1_SCIDR;

return rx_out;
}

0 Kudos

2,245 Views
dynapb
Contributor IV

Hi Gayarhri

Did you set the peripheral enable reg GPIO_E_PER = 0x0003; as mentioned above by XiangJun?

Also add the curly braces to the while waits.

Also try the TDRE clear by reading the SCI0_SCISR like I mentioned in my latest response to Sasi.

Pete
    

0 Kudos

2,245 Views
dynapb
Contributor IV

You should add more information.

What are you using to code, assembly, C, Processor Expert?

What is your init code look like?

0 Kudos

2,245 Views
sasikumar_e
Contributor II

Hi Peter,

I like to code in assembly c,

My initialization code looks like

    SCI0_SCIBR = 0x0187;
    SCI1_SCIBR = 0x0187;

    GPIO_D_PUR = 0x0000;
    GPIO_D_DDR = 0x0002;

    GPIO_E_PUR = 0x0000;
    GPIO_E_DDR = 0x0080;

0 Kudos

2,245 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Sasi,

Regarding your question, for example, if you want to use SCI0, you have to configure the SCI0 pin as SCI0 pins because the pins are multiplexed.

GPIO_E_PER|=0x03; //1 = Pin is for peripheral (Normal mode)

//configure the baudrate of SCI0, it is dependent on the IPBUS clock

SCIBR=0xxxxx; //SCI Baud Rate = IPBus Clock/(16 × SBR)

SCICR=0x00AC; enable both transmitter and receiver and enable interrupt, SCI is 8N1(8 bits, one start and one stop mode, no parity mode)

IPR8|=0x0xC0; //set the priority of SCI transmitter INT

//open interrupt by clearing I0/I1 bits in SR reg

Cpu_EnableInt();

//asm(bfclr #$300, SR);

SCIDR='a';

for(;;)

{

}

void sci_int(void)

{

SCIDR='a';

}

In the vectors.c

 JSR  Cpu_Interrupt                   /* Interrupt no. 68 (Unused) - ivINT_SCI0_TxEmpty  */

to

 JSR  Fsci_int; Cpu_Interrupt                   /* Interrupt no. 68 (Unused) - ivINT_SCI0_TxEmpty  */

But I dot test the code, pls have a try.

BR

XiangJun Rong

pastedImage_1.png

0 Kudos

2,245 Views
sasikumar_e
Contributor II

Thanks xiangjun,

i have tried with these combination even while running through codewarrior simulation setup i could not find any changes in

SCI0_SCISR_TDRE, SCI0_SCISR_RDRF 

0 Kudos

2,245 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Sasi,

I forgot that you have to set the gated clock bit of SCI0 module, pls set it as the following screenshot.

SIM_PCE|=0x10;

BR

XiangJun Rong

pastedImage_11.png

0 Kudos

2,245 Views
sasikumar_e
Contributor II

Thanks xiangjun,

i have tried that at first but there was no use, since from the reset the SIM_PCE is 1 so i neglected that line

Regards,

sasikumar E

0 Kudos

2,245 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Sasi,

You said that "i have tried with these combination even while running through codewarrior simulation setup i could not find any changes in SCI0_SCISR_TDRE, SCI0_SCISR_RDRF", what is the  "codewarrior simulation"? I soppose that the CW simulation can only simulate the core operation, it can not simulate the peripherals. You have to connect to board and download code to board via USBTAP/Multilink Universal devices and have a test.

BR

XiangJun Rong

0 Kudos

2,245 Views
sasikumar_e
Contributor II

Hi xiangjun,

I tried debugging with the hardware and did not get the output,

then we reset the dsc MC56F8367 and gave power supply and manually sorted the TXD0 & RXD0 provides communication between dsc and software, whereas after debugging the code into the hardware and even for manual sorting it does not provide any communication between dsc and software

Thanks & Regards

Sasikumar E

0 Kudos

2,245 Views
dynapb
Contributor IV

Hi Sasi

You mentioned "we reset the dsc MC56F8367 and gave power supply and manually sorted the TXD0 & RXD0 provides communication between dsc and software".

When you get this communication is that with your code (61 hex?) or are you seeing the built in Bootloader's startup XON char (11 hex)?

All new 8367's come with a preprogrammed bootloader.  The bootloader runs at 115200 baud and outputs an XON character at startup.

Pete

0 Kudos

2,245 Views
sasikumar_e
Contributor II

HI Peter,

Most likely it must be running through the bootloader program, since when we debug our program we dont get any output, i have our sample program in our above replies kindly check with it 

Sasi

0 Kudos

2,245 Views
dynapb
Contributor IV

Hi Sasi

You should add curly braces to the while's.

void SendChar()
{

   //Manual 13.4.3.2 says to clear the TDRE by reading it before writing the SCIDR to make sure it is clear.

    Tx = SCI0_SCISR;
    SCI0_SCIDR = 0x0061;
    //while(!SCI0_SCISR_TDRE) { }  //curly's.  Also no reason to wait here, just wait in receive.
    //no reason to read here. Tx = SCI0_SCIDR;
}

In your receive function you are not reading the receive reg.

void RecvChar()
{
  SCI0_SCISR = 0x0000;
  while(!SCI0_SCISR_RDRF) { }  //curly's
 // chr = Tx;

  char = SCI0_SCIDR;

  Tx = char;      //Just put one breakpoint here and see what char is (if you get a break).
}

Also are you just running with a loop-back between Tx and Rx?

Pete

2,245 Views
sasikumar_e
Contributor II

Hi xiangjun,

We are using a FT232R USB to UART converter in for the SCI0 .

one of our sample code

#include "MC56F8367.h"

void SendChar();
void RecvChar();

volatile int TxCharInt = 0;
volatile int RxCharInt = 0;
unsigned int Tx, chr;

void SendChar()
{
    SCI0_SCIDR = 0x0061;
    while(!SCI0_SCISR_TDRE)
    Tx = SCI0_SCIDR;
}

void RecvChar()
{
  SCI0_SCISR = 0x0000;
  while(!SCI0_SCISR_RDRF)
  chr = Tx;
}

void main(void)
{
    SIM_PCE    = 0x0010;
    GPIO_E_PER = 0x0003;
    GPIO_E_DDR = 0x0001;
    SCI0_SCIBR = 391;
    SCI0_SCICR = 0x000C;

    SendChar();
    RecvChar();
}

Thanks & Regards,

Sasikumar E

0 Kudos

2,245 Views
sasikumar_e
Contributor II

Hi xiangjun,

We are using a FT232R USB to UART converter in for the SCI0 

Thanks & Regards,

Sasikumar E

0 Kudos