Hi!
In mid-December 2024, I created a project with a PIC18F46K80 MCU in Flowcode 10. It worked fine. Since then, I have updated the component libraries several times. Now I should modify the program, but I have found that the UART "Send String" command no longer sends the string to the line. The program does not stop at the command, it continues to run, but nothing happens on the UART output. If I use the "Send Char" or "Send Number" command, it works fine. Can you help me with this?
Regards, Sasi
UART "SendString" command problem [SOLVED]
-
- Posts: 107
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 12:11 pm
- Has thanked: 37 times
- Been thanked: 14 times
UART "SendString" command problem [SOLVED]
Last edited by Sasi on Sat May 10, 2025 4:40 pm, edited 3 times in total.
-
- Valued Contributor
- Posts: 1520
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 732 times
Re: UART "SendString" command problem
It's odd - as, for example, SendNumber uses PrintString (it converts the number to a string then sends it...)
Can you post an example that demonstrates?
Martin
Can you post an example that demonstrates?
Martin
Re: UART "SendString" command problem
Hi Martin,
I quickly put together an example.
This behaves exactly as I described.
The result of the last UART command is not displayed in the TX line.
The commands before it work.
Thanks for looking.
Sasi
I quickly put together an example.
This behaves exactly as I described.
The result of the last UART command is not displayed in the TX line.
The commands before it work.
Thanks for looking.
Sasi
-
- Valued Contributor
- Posts: 1520
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 732 times
Re: UART "SendString" command problem
Hi,
How are you testing this - for example logic analyser connected to Tx or with an FTDI convertor connected to Tx and Rx. Not just looking at the reply from a GSM or BT adapter?) I'm assuming this is testing on hardware too (it works AOK in SIM)
What happens if you add another SendString after the current end line (or a delay) - if the program terminates immediately then the UART might not get flushed correctly - although for most MCUs this would not be the case... The program has end_loop goto end_loop when it 'falls off the end' - try adding
while(1)
delay(10ms)
Martin
How are you testing this - for example logic analyser connected to Tx or with an FTDI convertor connected to Tx and Rx. Not just looking at the reply from a GSM or BT adapter?) I'm assuming this is testing on hardware too (it works AOK in SIM)
What happens if you add another SendString after the current end line (or a delay) - if the program terminates immediately then the UART might not get flushed correctly - although for most MCUs this would not be the case... The program has end_loop goto end_loop when it 'falls off the end' - try adding
while(1)
delay(10ms)
Martin
-
- Posts: 42
- Joined: Fri Dec 18, 2020 7:33 am
- Location: Turkey
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: UART "SendString" command problem
Hello Dear Sasi
Fake Microcontrollers
Especially clone or refurbished microcontrollers, which are widely circulated in the market, may not work at the original Microchip quality.
They often have stability problems with high-frequency operations (e.g. 115200 baud).
Sometimes ID codes cannot be read or they show strange behavior when the application is not loading.
Solution: A good method would be to buy from a reliable supplier and check the ID and Device ID registers if in doubt.
2. Crystal / Internal Oscillator Settings
Since baudrate calculations are directly dependent on the oscillator frequency, even small deviations in the internal oscillator can cause problems in communication.
Especially if the internal oscillator is used and the baudrate is high (>38400), the margin of error is seriously affected.
The settings of bits such as BRGH, BRG16 also affect this balance.
Solution:
Use an external crystal (for example 8MHz or 16MHz).
Calculate the SPBRG value manually.
Trying lower speeds if possible.
3. 115200 Baudrate Issues
Using high baudrate in this series (especially in 18F series) can cause serious timing problems.
Because in some hardware versions the timing of the USART module deviates at high speeds.
Solution:
First use 9600 or 19200 for testing.
If it works properly at these speeds, the problem is 90% baudrate.
4. Flowcode Library Issues
In some versions of Flowcode, the USART module may not be configured correctly. Especially in Asynchronous mode and 8-bit/16-bit configurations
Fake Microcontrollers
Especially clone or refurbished microcontrollers, which are widely circulated in the market, may not work at the original Microchip quality.
They often have stability problems with high-frequency operations (e.g. 115200 baud).
Sometimes ID codes cannot be read or they show strange behavior when the application is not loading.
Since baudrate calculations are directly dependent on the oscillator frequency, even small deviations in the internal oscillator can cause problems in communication.
Especially if the internal oscillator is used and the baudrate is high (>38400), the margin of error is seriously affected.
The settings of bits such as BRGH, BRG16 also affect this balance.
Use an external crystal (for example 8MHz or 16MHz).
Calculate the SPBRG value manually.
Trying lower speeds if possible.
Using high baudrate in this series (especially in 18F series) can cause serious timing problems.
Because in some hardware versions the timing of the USART module deviates at high speeds.
First use 9600 or 19200 for testing.
If it works properly at these speeds, the problem is 90% baudrate.
In some versions of Flowcode, the USART module may not be configured correctly. Especially in Asynchronous mode and 8-bit/16-bit configurations
Sadık Süme
Re: UART "SendString" command problem
Hi,
Thanks for the suggestions, of course I have already checked them.
I have done some more tests which I have attached to the post, but I have no idea what could be causing the problem.
Interestingly, I have added a 5ms delay to the "UART_Test_2_Working" program and it no longer works ("UART_Test_2_NOT Working").
Maybe I should reinstall Flowcode10?
I am losing my mind! Addition:
I tested the UART TX output with a Logic Analyzer.
I disconnected the TX output from the GSM radio.
Thanks for the suggestions, of course I have already checked them.
I have done some more tests which I have attached to the post, but I have no idea what could be causing the problem.
Interestingly, I have added a 5ms delay to the "UART_Test_2_Working" program and it no longer works ("UART_Test_2_NOT Working").
Maybe I should reinstall Flowcode10?
I am losing my mind! Addition:
I tested the UART TX output with a Logic Analyzer.
I disconnected the TX output from the GSM radio.
Last edited by Sasi on Wed Apr 16, 2025 3:34 pm, edited 1 time in total.
-
- Posts: 42
- Joined: Fri Dec 18, 2020 7:33 am
- Location: Turkey
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: UART "SendString" command problem
“AT+CNMI=2,0,0,0,0\r\n”
load this command into a string for example: STR_TX[20] Make sure it is 20 characters.
And try sending it as two separate command strings.
STR_TX="AT+CNMI=2,0,0,0,0” 17 character
STR_TX="\r\n” 4 character
Please check the Configuration Settings. When you install, these settings become default.
load this command into a string for example: STR_TX[20] Make sure it is 20 characters.
And try sending it as two separate command strings.
STR_TX="AT+CNMI=2,0,0,0,0” 17 character
STR_TX="\r\n” 4 character
Please check the Configuration Settings. When you install, these settings become default.

- Attachments
-
- UART_TEST_SADIK.fcfx
- (15.25 KiB) Downloaded 29 times
Sadık Süme
Re: UART "SendString" command problem
Hi Sadik,
Thanks for the suggestion.
I tried the program you modified, but unfortunately the running result is similar to the original.
The following character sequence is repeated cyclically on the UART output:
"1865" -20ms_delay- "ATE0\r\n" -20ms_delay- "1865" -20ms_delay- "ATE0\r\n" -60ms_delay.
The SendString commands seem to have no effect.
I will try it with a different type of Microchip MCU from the PIC18 family.
Thanks again,
Sasi
Thanks for the suggestion.
I tried the program you modified, but unfortunately the running result is similar to the original.
The following character sequence is repeated cyclically on the UART output:
"1865" -20ms_delay- "ATE0\r\n" -20ms_delay- "1865" -20ms_delay- "ATE0\r\n" -60ms_delay.
The SendString commands seem to have no effect.
I will try it with a different type of Microchip MCU from the PIC18 family.
Thanks again,
Sasi
-
- Matrix Staff
- Posts: 1968
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 629 times
- Been thanked: 659 times
Re: UART "SendString" command problem
Hi Sasi.
I have just tried your UART_Test_2_NOT Working.fcfx on a 18F46K80.
The only difference is I set the internal osc to 64MHz ,whereas you are using external osc.
It should not make any difference to the results.
This is what the analyser shows for baud of 19200: That would suggest there is nothing wrong with the UART SendString function on 18F46K80
Therefore I'm moving this topic from Bug Reports
I have just tried your UART_Test_2_NOT Working.fcfx on a 18F46K80.
The only difference is I set the internal osc to 64MHz ,whereas you are using external osc.
It should not make any difference to the results.
This is what the analyser shows for baud of 19200: That would suggest there is nothing wrong with the UART SendString function on 18F46K80
Therefore I'm moving this topic from Bug Reports
Martin