UART Issues
Moderator: Benj
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
UART Issues
Hi,
Iam Using PIC18F67J11 Chip with external 20MHz Crystal between OSC1 & OSC2.
first step i checked a blink circuit it worked fine
second i added with UART-1 with Baud 9600 a simple string to Transmit while startup, but i cant receive a string and there are some JUNK in the RX window. I feel that Config Bits are not properly assigned. Kindly help with this
Thank You,
Iam Using PIC18F67J11 Chip with external 20MHz Crystal between OSC1 & OSC2.
first step i checked a blink circuit it worked fine
second i added with UART-1 with Baud 9600 a simple string to Transmit while startup, but i cant receive a string and there are some JUNK in the RX window. I feel that Config Bits are not properly assigned. Kindly help with this
Thank You,
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: UART Issues
Hello,
Please can you attach your Flowcode project file so we can investigate for you.
Please can you attach your Flowcode project file so we can investigate for you.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
Re: UART Issues
Benj wrote:Hello,
Please can you attach your Flowcode project file so we can investigate for you.
- Attachments
-
- test-1.fcfx
- (9.86 KiB) Downloaded 208 times
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: UART Issues
Looking at your Flowchart the baud is not set at 9600 it is set at 115200cubetronix wrote: i added with UART-1 with Baud 9600 a simple string to Transmit while startup, but i cant receive a string and there are some JUNK in the RX window.
In general if you are not clearing the Watchdog timer you should switch it off ,this can cause you some strange errors I do not see in your flowchart that you clear the Watchdog
you should also make sure your Oscillator settings are correct this device has a tricky setup for the Oscillator as general info to a UART that does not work
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
Re: UART Issues
QMESAR wrote:Looking at your Flowchart the baud is not set at 9600 it is set at 115200cubetronix wrote: i added with UART-1 with Baud 9600 a simple string to Transmit while startup, but i cant receive a string and there are some JUNK in the RX window.
Baud.jpg
In general if you are not clearing the Watchdog timer you should switch it off ,this can cause you some strange errors I do not see in your flowchart that you clear the Watchdog
WDT.jpg
you should also make sure your Oscillator settings are correct this device has a tricky setup for the Oscillator as general info to a UART that does not work
Thanks for your prompt reply,
I know the baud rate is changed, yesterday i was trying with it and forget to change before sharing it,
the problem is same if i use any baud rate. and i want to know as per datasheet
Oscillator Types are
The PIC18F87J11 family of devices can be operated in
eight different oscillator modes:
1. HS High-Speed Crystal/Resonator
2. HSPLL High-Speed Crystal/Resonator
with Software PLL Control
3. EC External Clock with FOSC/4 Output
4. ECPLL External Clock with Software PLL
Control
5. INTIO1 Internal Oscillator Block with FOSC/4
Output on RA6 and I/O on RA7
6. INTIO2 Internal Oscillator Block with I/O on
RA6 and RA7
7. INTPLL1 Internal Oscillator Block with Software
PLL Control, FOSC/4 Output on RA6
and I/O on RA7
8. INTPLL2 Internal Oscillator Block with Software
PLL Control and I/O on RA6 and RA7
but in flow code7 Oscillator Types
HS USB-HS
HS + PLL HS-USB HS +PLL
i am using 20 MHz external crystal so in which mode i have to use
Thank You
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: UART Issues
I cannot yet see anything wrong.
HS USB-HS should be OK.
Could you explain more about your serial link hardware?
HS USB-HS should be OK.
Could you explain more about your serial link hardware?
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
Re: UART Issues
I found some compilation error before regarding XC8 and updated the XC8 from microchip now i found this warning, can some one help to resolve this. below is the compilation result for reference.
Target folder: G:\FLOW CODE\Projects\serial test
Source name: G:\FLOW CODE\Projects\serial test\serial test.fcfx
Title:
Description:
Device: PIC.18F.18F66J11
Generated by: Flowcode v7.2.1.4
Date: Friday, February 02, 2018 20:03:46
Users: 1
Registered to:
Licence key:
NOT FOR COMMERCIAL USE
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe --chip=18F66J11 "serial test.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration
. .
serial test.c:
34: __config("__PROG_CONFIG", "pic18", 0x1, 0xFFFF);
^ (1504) the PIC18 extended instruction set was enabled but is not supported by this compiler
(908) exit status = 1
(908) exit status = 1
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1
FINISHED
Target folder: G:\FLOW CODE\Projects\serial test
Source name: G:\FLOW CODE\Projects\serial test\serial test.fcfx
Title:
Description:
Device: PIC.18F.18F66J11
Generated by: Flowcode v7.2.1.4
Date: Friday, February 02, 2018 20:03:46
Users: 1
Registered to:
Licence key:
NOT FOR COMMERCIAL USE
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe --chip=18F66J11 "serial test.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration
. .
serial test.c:
34: __config("__PROG_CONFIG", "pic18", 0x1, 0xFFFF);
^ (1504) the PIC18 extended instruction set was enabled but is not supported by this compiler
(908) exit status = 1
(908) exit status = 1
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1
FINISHED
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: UART Issues
Hi.
Try to Switch the Extended CPU instruction set off,
Try to Switch the Extended CPU instruction set off,
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
Re: UART Issues
Thanks for the reply, after disabling the extended CPU UART is working but only TX, i cant receive anything with or without interrupt. kindly check the flowcode.QMESAR wrote:Hi.
Try to Switch the Extended CPU instruction set off,
Thank You
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: UART Issues
Hi .
I see no problem with the Flowchart or the generated C code.
However not saying there is no error unfortunate I do not have such an device to test on HW
Are using real HW to test or Simulation in FC? (just a reminder FC does not simulate UART Interrupts)
I see no problem with the Flowchart or the generated C code.
However not saying there is no error unfortunate I do not have such an device to test on HW
Are using real HW to test or Simulation in FC? (just a reminder FC does not simulate UART Interrupts)
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 11
- Joined: Tue Oct 17, 2017 4:09 pm
- Contact:
Re: UART Issues
i am using real HW.QMESAR wrote:Hi .
I see no problem with the Flowchart or the generated C code.
However not saying there is no error unfortunate I do not have such an device to test on HW
Are using real HW to test or Simulation in FC? (just a reminder FC does not simulate UART Interrupts)
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: UART Issues
Hello,
In your UART_1 macro you need to call the ReceiveChar component macro to clear the UART RX buffer. Otherwise it may overflow and prevent more data coming in.
In your UART_1 macro you need to call the ReceiveChar component macro to clear the UART RX buffer. Otherwise it may overflow and prevent more data coming in.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel