View previous topic :: View next topic |
Author |
Message |
scanan
Joined: 13 Aug 2004 Posts: 67 Location: Turkey
|
rs232 prints rubish |
Posted: Wed May 07, 2025 2:42 am |
|
|
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
|
|
Posted: Wed May 07, 2025 4:00 am |
|
|
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
|
rs232 problem |
Posted: Wed May 07, 2025 5:57 am |
|
|
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: 9472 Location: Greensville,Ontario
|
|
Posted: Wed May 07, 2025 7:14 am |
|
|
get RID of the 'restart WDT' codes and see what happens !!! |
|
 |
asmallri
Joined: 12 Aug 2004 Posts: 1645 Location: Perth, Australia
|
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19828
|
|
Posted: Wed May 07, 2025 11:13 am |
|
|
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
|
rs232 prints rubish |
Posted: Thu May 08, 2025 5:42 am |
|
|
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
|
rs232 prints rubish |
Posted: Thu May 08, 2025 6:17 am |
|
|
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: 9472 Location: Greensville,Ontario
|
|
Posted: Thu May 08, 2025 6:19 am |
|
|
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
|
|
Posted: Thu May 08, 2025 6:25 am |
|
|
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
|
|
Posted: Thu May 08, 2025 7:14 am |
|
|
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
|
|
Posted: Thu May 08, 2025 7:26 am |
|
|
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!! |
|
 |
|