PSoC 4100S Inverting UART signals using SmartIO (TSoC)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

IMG_4290.JPG

For a question about how to invert UART signals without using UDB,

I created a simple project using TSoC (CY8C4146LQI-S433).

Probably same trick can be applied for other devices with SmartIO.

下記のスレでタイトルのテーマをいただきましたので、

トラ技付録の TSoC で作ってみました。

UARTの反転出力(2)

Schematic

000-schematic.JPG

SmartIO

001-SmartIO.JPG

LUT0, 1, 4, 7

002-LUT0.JPG

003-LUT1.JPG

004-LUT4.JPG

005-LUT7.JPG

Pins:

006-PINS.JPG

main.c

===================

#include "project.h"

#include "stdio.h"

#define RX_BUF_LEN 16

int main(void)

{

    volatile char rx_buf[RX_BUF_LEN+1] ;

    int i = 0 ;

   

    CyGlobalIntEnable; /* Enable global interrupts. */

   

    UART_Start() ;

   

    SmartIO_Start() ;

    for(;;)

    {

        UART_UartPutString("Hello\n\r") ;

        CyDelay(100) ;

        i = 0 ;

        while(UART_SpiUartGetRxBufferSize()) {

            rx_buf[i++] = UART_UartGetChar() ;

            if (i >= RX_BUF_LEN)  {

                break ;

            }

        }

        rx_buf = 0 ;

        i = 0 ;

    }

}

===================

Waveform

IMG_4289.JPG

To test RX, I shorted P3[6] and P3[7] using a jumper wire.

And with debugger, I could confirm that rx_buf] received "Hello".

RX 側を試すのに外部で P3[6] と P3[7] をジャンパで繋いで実験してみました、

デバッガで確認したところ、rx_buf[] に "Hello" が入っていたので

送受信ともに反転で動いているようでした。

moto

0 Likes
0 Replies