This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SSC Port (Second Port) Programming of C167

Hello:

I am working on interfacing(connecting) the mini-Module 167 to dSpace system through RS-485.
For this purpose I have to use the second serial port of the evaluation board of the mini-Module 167.
The controller number is C167CR-LM.

Taking a reference what was mentioned in previous forum (
C166: USING 2ND SERIAL PORT (ASC1) ON INFINEON XC16X DEVICES, http://www.keil.com/support/docs/2601.htm).
I modified the putcahr.c & getkey.c files in order to suit my controller settings and register names.

If I select (#define USE_ASC 0) every thing will go well, but if i select 1 to use the second port, the compiler will compile the code without any errors but no output on the simulator, even no output on the controller itself.

Please find my code below:

#include <reg167.h>
#include <stdio.h>
#define USE_ASC   1
void main (void) {
#ifndef Monitor         /* do not initialize if you use Monitor-166      */

#if (USE_ASC == 0)
  P3  |= 0x0400;                        /* set port 3.10 output latch (TXD) */
  DP3 |= 0x0400;                        /* configure port 3.10 for output   */
                                        /* operation. ( TXD output)         */
  DP3 &= 0xF7FF;                            /* configure port 3.11 for input    */
                                        /* operation. ( RXD input)          */
  S0TIC = 0x80;                         /* set transmit interrupt flag      */
  S0RIC = 0x00;                         /* delete receive interrupt flag    */
  S0BG  = 0x40;                         /* set baudrate to 9600 baud        */
  S0CON = 0x8011;                       /* set serial mode                  */

#else
  P3  |= 0x0200;        /* 0x0200 SET PORT 3.0[3.9] OUTPUT LATCH (TXD)               */
  DP3 |= 0x0200;        /* 0x0200 SET PORT 3.0 [3.9] DIRECTION CONTROL (TXD OUTPUT)   */
  DP3 &= 0xFEFF;        /* 0xFEFF RESET PORT 3.1[3.8] DIRECTION CONTROL (RXD INPUT)  */
  SSCTIC = 0x80;        /* SET TRANSMIT INTERRUPT FLAG                   */
  SSCRIC = 0x00;        /* DELETE RECEIVE INTERRUPT FLAG                 */
  SSCBR  = 0x0009;      /* 0x0009 SET BAUDRATE TO 1MB BAUD @ 20MHz             */
  SSCCON = 0x8011;      /* 0xC057 SET SERIAL MODE                               */

#endif

#endif




while (1) {
printf("E\n");
}
}

Of course I have included the modified putchar.c & getkey.c in my project.
Also, in the simulator, I have assigned WIN2 to receive from SSCIN & SSCOUT, but still no output.

Would you please tell me what is wrong in my code.

Thank you in advance for your advise.

Best Regards,

Parents
  • The processor manual says:
    The high-speed synchronous serial interface can be configured in a very flexible way, so it can be used with other synchronous serial interfaces (e.g. the ASC0 in synchronous mode), serve for master/slave or multimaster interconnections or operate compatible with the popular SPI interface. So it can be used to communicate with shift registers (IO expansion), peripherals (e.g. EEPROMs etc.) or other controllers (networking). The SSC supports half-duplex and full-duplex communication. Data is transmitted or received on pins MTSR/P3.9 (Master Transmit/Slave Receive) and MRST/P3.8 (Master Receive/ Slave Transmit). The clock signal is output or input on pin SCLK/P3.13. These pins are alternate functions of Port 3 pins.

    If you have an external CAN chip with SPI interface, then you will obviously be able to use the second port for CAN.

    A synchronous serial port that supports the correct number of bits can be used to send asynchronous data. You just ignore the clock signal it generates.

    You could potentially abuse a more advanced chip to receive data too, as long as the transmitting side have a small baudrate error. You could use a built-in timer to generate a clock signal. You would then need an edge-trigged interrupt to either activate the slave-select signal, or to enable the baudrate clock. Just note that this is not intended usage, and such abusive use will not be as good as a real UART.

Reply
  • The processor manual says:
    The high-speed synchronous serial interface can be configured in a very flexible way, so it can be used with other synchronous serial interfaces (e.g. the ASC0 in synchronous mode), serve for master/slave or multimaster interconnections or operate compatible with the popular SPI interface. So it can be used to communicate with shift registers (IO expansion), peripherals (e.g. EEPROMs etc.) or other controllers (networking). The SSC supports half-duplex and full-duplex communication. Data is transmitted or received on pins MTSR/P3.9 (Master Transmit/Slave Receive) and MRST/P3.8 (Master Receive/ Slave Transmit). The clock signal is output or input on pin SCLK/P3.13. These pins are alternate functions of Port 3 pins.

    If you have an external CAN chip with SPI interface, then you will obviously be able to use the second port for CAN.

    A synchronous serial port that supports the correct number of bits can be used to send asynchronous data. You just ignore the clock signal it generates.

    You could potentially abuse a more advanced chip to receive data too, as long as the transmitting side have a small baudrate error. You could use a built-in timer to generate a clock signal. You would then need an edge-trigged interrupt to either activate the slave-select signal, or to enable the baudrate clock. Just note that this is not intended usage, and such abusive use will not be as good as a real UART.

Children