- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is anyone used software uart in PSOC 4100 plus.
I have ported Arduino SoftwareSerial library but it didn't succed
Please help me to make software Uart receive library for it.
Thank You
Bivay
Solved! Go to Solution.
- Tags:
- software uart
- uart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got solution using pin interrupt to be used and manual reading of pin state with delay.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Software UART component is already available in the device. Kinldy check the component catalog for the device.
Best Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reply,
Bu, I didn't asked for Software Uart Transmit .
I know about it.
I asked for software based uart receive. as I didn't find any support about receiver of uart.
Please help if available.
Thank You
Bivay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As /odissey1-san stated above, using UART component must be much easier and more reliable.
But just for fun, I tried with my (wing-less) CY8CKIT-149.
Schematic
Pins
NOTE: I needed jumper P7[0] and P2[0] to use the KitProg USB-Serial port for testing.
main.c
===================
#include "project.h"
#include "stdio.h"
#define HALF_BIT 52 /* 9600Hz -> 104.17us = 1bit time */
volatile int start_bit_flag = 0 ;
volatile uint8_t rx_data = 0 ;
#define STR_LEN 64
char str[STR_LEN+1] ;
void print(char *str)
{
HARD_UART_UartPutString(str) ;
}
CY_ISR(start_bit_isr)
{
soft_rx_ClearInterrupt() ;
soft_rx_isr_Disable() ;
start_bit_flag = 1 ;
}
uint8_t receive_byte(void)
{
uint8_t data = 0 ;
uint8_t mask = 0x01 ;
int i ;
CyDelayUs(HALF_BIT*2) ;
for (i = 0 ; i < 8 ; i++ ) {
data |= soft_rx_Read() ? mask : 0 ;
mask <<= 1 ;
CyDelayUs(HALF_BIT * 2) ;
}
// no parity
// doing nothing for party
// waiting for stop bit
while(soft_rx_Read() == 0) {
CyDelayUs(HALF_BIT) ;
}
return( data ) ;
}
void cls(void)
{
print("\033c") ; /* reset */
CyDelay(20) ;
print("\033[2J") ; /* clear screen */
CyDelay(20) ;
}
void splash(void)
{
cls() ;
print("Soft UART Test") ;
snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
void init_hardware(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
HARD_UART_Start() ;
soft_rx_isr_StartEx(start_bit_isr) ;
splash() ;
}
int main(void)
{
uint8_t rx_data = 0 ;
init_hardware() ;
for(;;)
{
if (start_bit_flag) {
rx_data = receive_byte() ;
HARD_UART_UartPutChar(rx_data) ;
start_bit_flag = 0 ;
soft_rx_ClearInterrupt() ;
soft_rx_isr_ClearPending() ;
soft_rx_isr_Enable() ;
}
}
}
===================
Tera Term Log
Note: My Tera Term is set as "Local Echo" so if we see same letters twice
that means the letter typed in the terminal was received by the soft_uart_rx
and sent back via the "HARD_UART"
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will try to use your solution thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bivay,
Check this UART Rx demo showing receiving simple commands from the terminal using SCB UART to control RGB LED on PSoC4200. There might be some differences with PSoC4100, but it should be helpful
Re: How to use 4 Uart in Psoc 4
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got solution using pin interrupt to be used and manual reading of pin state with delay.
Thank You