CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

rs232 prints rubish

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
scanan



Joined: 13 Aug 2004
Posts: 67
Location: Turkey

View user's profile Send private message Visit poster's website

rs232 prints rubish
PostPosted: Wed May 07, 2025 2:42 am     Reply with quote

Hello
I have a rs232 problem on pic18f45k40



when print some text I get this result

U V W $ Y YZ Y C irmware v1.00
Compiled on
07-May-25
11:20:24

normally I have to get
Firmware v1.00

what could be the problem
compilee ccs 5.115

cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19828

View user's profile Send private message

PostPosted: Wed May 07, 2025 4:00 am     Reply with quote

Almost certainly hardware.
Suggests the line is floating, and not pulled up before transmission starts.
Or something else is clocking the line.
How is the physical connection made?.
Does the data repeat the same, or is it different each time?.
How is the power supplied?.
Is this at the start (power on)?.
Is this using a hardware UART, or software serial?.
scanan



Joined: 13 Aug 2004
Posts: 67
Location: Turkey

View user's profile Send private message Visit poster's website

rs232 problem
PostPosted: Wed May 07, 2025 5:57 am     Reply with quote

Ttelmah wrote:
Almost certainly hardware.
Suggests the line is floating, and not pulled up before transmission starts.
Or something else is clocking the line.
How is the physical connection made?.
Does the data repeat the same, or is it different each time?.
How is the power supplied?.
Is this at the start (power on)?.
Is this using a hardware UART, or software serial?.


I think no need of pull up for tx pin I did too many project without it never encountered this issue
I am using FTDi232 to connect my board to PC..

settings of UART
#use delay(clock=64000000,RESTART_WDT)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,RESTART_WDT)

void version(void)
{
//------------------------------------------------------------------------------
//-- firmware version
//------------------------------------------------------------------------------
printf("Telemmote Receiver\r\n");
printf("Firmware v1.00\r\n");
printf("Compiled on \r\n");
printf(__DATE__);
printf("\r\n");
printf(__TIME__);
printf("\r\n");
delay_ms(250);
printf("Telemmote Receiver\r\n");
printf("Firmware v1.00\r\n");
printf("Compiled on \r\n");
printf(__DATE__);
printf("\r\n");
printf(__TIME__);
printf("\r\n");

//------------------------------------------------------------------------------
}
the first block of pritnt include garbage
but the second print is OK
-the power supply is 10 watt irm-10-12 smps and the feet to and LDO wihich power the PIC with 3.3 volts
-the printed are done after the PIC is configured.
-Hardware UART is used

cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
temtronic



Joined: 01 Jul 2010
Posts: 9471
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed May 07, 2025 7:14 am     Reply with quote

get RID of the 'restart WDT' codes and see what happens !!!
asmallri



Joined: 12 Aug 2004
Posts: 1645
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed May 07, 2025 7:30 am     Reply with quote

and add Errors
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19828

View user's profile Send private message

PostPosted: Wed May 07, 2025 11:13 am     Reply with quote

and on pull-ups, these are needed if the line floats. This is why things like
RS485 buffer chips are available in versions that guarantee to flow to the
idle state, and if these are not used the bus dialling should ensure the drive
does this instead.
My thought is that the transmitting PIC line is floating till the UART starts.
Depending on the baud rate and how reset is handled, the result is garbage
preceding the first byte and giving a false start so this too is corrupted.
scanan



Joined: 13 Aug 2004
Posts: 67
Location: Turkey

View user's profile Send private message Visit poster's website

rs232 prints rubish
PostPosted: Thu May 08, 2025 5:42 am     Reply with quote

temtronic wrote:
get RID of the 'restart WDT' codes and see what happens !!!

still the same
when added ERROR nothing changed
I also added a pullup resistor on TX pin no effect

seems the problem is at startup.
After startup anywhere I put a printf there is no problem.

and I get everytime the same garbage everytime I compile
U V W $ Y YZ Y C irmware v1.00
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
scanan



Joined: 13 Aug 2004
Posts: 67
Location: Turkey

View user's profile Send private message Visit poster's website

rs232 prints rubish
PostPosted: Thu May 08, 2025 6:17 am     Reply with quote

I finnaly go for a quasi solution
like that
putc(0);

printf("\r\nTelemmote Receiver\r\n");
printf("Firmware v1.00\r\n");
printf("Compiled on \r\n");
printf(__DATE__);
printf("\r\n");
printf(__TIME__);
printf("\r\n");

But a problem to be solved.
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
temtronic



Joined: 01 Jul 2010
Posts: 9471
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu May 08, 2025 6:19 am     Reply with quote

possible help...
1) add PUT to the fuses(Power Up Timer )

2) add a 250ms delay BEFORE the first print code.
scanan



Joined: 13 Aug 2004
Posts: 67
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Thu May 08, 2025 6:25 am     Reply with quote

temtronic wrote:
possible help...
1) add PUT to the fuses(Power Up Timer )

2) add a 250ms delay BEFORE the first print code.


Tested but not solve for what you mentioned.
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19828

View user's profile Send private message

PostPosted: Thu May 08, 2025 7:14 am     Reply with quote

May I ask how this connection is actually done???
You say you are using an FTDI adapter. Is this a USB to 5v or USB to
RS232 unit?. If the latter how is your RS232 to 5v adaption done at the PIC?.
This sounds as if you have something like a level shifter that needs to see
the line driven high then low then high again to start working.
Put(0), will send 9bits of 0v, then go high again before the start bit for
your message. This is exactly what is needed to charge up certain types
of inverter based connection.
asmallri



Joined: 12 Aug 2004
Posts: 1645
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu May 08, 2025 7:26 am     Reply with quote

scanan wrote:
temtronic wrote:
possible help...
1) add PUT to the fuses(Power Up Timer )

2) add a 250ms delay BEFORE the first print code.


Tested but not solve for what you mentioned.


90% of the time it is the grounding that is the culprit.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group