UART Issue with PICDEM PlUS 2 board

  • Thread starter Thread starter Neyolight
  • Start date Start date
  • Tags Tags
    Board
Click For Summary
SUMMARY

The forum discussion centers on a UART communication issue with the PICDEM 2 Plus board featuring the PIC18F4620 microcontroller. The user reports that their UART code initially functioned correctly but subsequently failed, yielding various error messages across different terminal applications, including Hyperterminal and RealTerm. A loopback test confirmed that the hardware is operational, suggesting a potential configuration or state change in the device. The user is advised to perform a power cycle reset to troubleshoot the issue further.

PREREQUISITES
  • Understanding of PIC18F4620 microcontroller architecture
  • Familiarity with UART communication protocols
  • Experience with Microchip's MPLAB IDE and C programming for embedded systems
  • Knowledge of serial communication testing tools like Hyperterminal and RealTerm
NEXT STEPS
  • Investigate the configuration settings for OpenUSART in the PIC18F4620
  • Learn about UART error handling and troubleshooting techniques
  • Explore power cycling methods for embedded systems to reset hardware states
  • Research common UART issues related to baud rate mismatches and signal integrity
USEFUL FOR

This discussion is beneficial for embedded systems developers, particularly those working with Microchip PIC microcontrollers, as well as engineers troubleshooting UART communication issues in their projects.

Neyolight
Messages
15
Reaction score
0
Hi Everyone

I have a PICDEM 2 Plus board with a PIC18F4620 on it. My UART code is given. The code worked perfectly fine the first time i programmed my chip but stopped working after that.

With Hyperterminal the error is : "Unable to open COMPORT 1. Please check your port setting"

With RealTer , the error is : Break condition received

With Putty : Nothing happens

I performed a loopback test on the board ( by taking our the PIC ) and Serial-to USAB adaptor and both works fine. The comport on my laptop works fine with other UART. Please guide me..I AM SUPER LOST !

Heres the code



#include <p18f4620.h>
#include <stdio.h>
#include <delays.h>
#include <usart.h>

// INTIO67 configures internal oscillator
#pragma config OSC=INTIO67, LVP=OFF, MCLRE=ON , WDT=OFF

void setup(void)
{
/* Clock Setup*/
OSCCON = 0b01110010; //select 8 MHz clock

/* Port Set Up*/
ADCON1 = 0b00001111; //set all pins to digital mode
TRISD = 0x00;
TRISA = 0x00;
TRISB = 0b00000000;
TRISC = 0b10000000; // RX is an input, TX is output

// PORTBbits.RB0=1; //Turn on the 4 LEDs
// PORTBbits.RB1=1;
// PORTBbits.RB2=1;
// PORTBbits.RB3=1;

// Turn on the 4 LEDs
// Microchip recommends writing to the PORT Latch rather than the PORT Pins
LATBbits.LATB0=1;
LATBbits.LATB1=1;
LATBbits.LATB2=1;
LATBbits.LATB3=1;


/* Interrupt Setup */
INTCON = 0x00; /* Clear Registers */
PIR1 = 0x00;
PIE1 = 0x00;
TMR1L = 0x00;
TMR1H = 0x00;
T1CON = 0x00;
RCON = 0x00;



/* RS232 Enable */
// OpenUSART Configures The Next Three Lines
//RCSTA = 0b10000000;
//TXSTA = 0b00100000;
//BAUDCON = 0b01000000;

// USART 9600 8-N-1
OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 12);

}


#pragma code
void main(void)
{
setup();

while (1)
{
putrsUSART(" Hello World! ");
// while(BusyUSART());
Delay10KTCYx(100);

}
}
 
Engineering news on Phys.org
If it worked once, then won't work again, I presume there must be some kind of hardware fault, or that you changed the state of the device.

Have you tried power off/on reset?
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
7K