18F67K40 UART Problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

18F67K40 UART Problem

Postby seokgi » Tue Jul 30, 2019 8:01 am

Hi. Everyone
I have to use five rs-232.
So I chose the PIC18F67K40.
But UART does not work.
Is the option wrongly selected?
I do not know the cause.
Can you help me?
Attach the file.
Thank you.
Attachments
V0.9.fcfx
(20.76 KiB) Downloaded 17 times

Lagoda
Posts: 141
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 60 times
Been thanked: 54 times
Contact:

Re: 18F67K40 UART Problem

Postby Lagoda » Tue Jul 30, 2019 1:05 pm

Hi, Seokgi

The clock signal of target circuit is it working ?
I think, if the clock source is an HS quartz crystal connected to the OSC1 and OSC2 pins, then the OSC2 output must be enabled in the Project Option / Configure window.

Best Regards,

Lagoda
Attachments
Quartz Crystal Operation.png
Quartz Crystal Operation.png (26.97 KiB) Viewed 950 times
These users thanked the author Lagoda for the post:
seokgi (Thu Aug 01, 2019 10:29 am)
Rating: 5.56%
 

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Tue Jul 30, 2019 1:54 pm

Thank you.
Circuit is working.
But uart is not work.

User avatar
LeighM
Matrix Staff
Posts: 1845
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 429 times
Been thanked: 612 times
Contact:

Re: 18F67K40 UART Problem

Postby LeighM » Tue Jul 30, 2019 2:59 pm

Do the UARTs output anything, even if invalid data?
Do you have an oscilloscope to check?
The clock speed in Project Options looks odd, is it correct?
These users thanked the author LeighM for the post:
seokgi (Thu Aug 01, 2019 10:29 am)
Rating: 5.56%
 

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Tue Jul 30, 2019 3:19 pm

The execution of the project file was confirmed with led.
Since it is necessary to use rs-232 2400 bps or data bit 7bit, we use 22.1184MHz which is double of 11.0592MHz.
I measured it with an oscilloscope, but no data at all.
And there seems to be a problem with MCLR RE3. RE3 will still work with the output.
Every time I use FC8, I am always in trouble. I chose FC8 because I could not C language.

Thank you for your help.

Lagoda
Posts: 141
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 60 times
Been thanked: 54 times
Contact:

Re: 18F67K40 UART Problem

Postby Lagoda » Tue Jul 30, 2019 10:34 pm

Hi,

According to the MPLAB Code Configurator: " External clock frequency is greater than recommended value(20MHz) "
You may have to try with a lower frequency.
But this is just an idea.


Unfortunately the MCLR pin can only be input port.
MCLR Disabled.png
MCLR Disabled.png (12.59 KiB) Viewed 926 times

Lagoda

Using MPLABX, I created a test program similar to the one you made in Flowcode.
I couldn't try it because I don't have this type of MCU.
All 5 TX outputs are supposed to send characters. The other ports will not move.
Attachments
Seokgi.X.production.hex
(3.81 KiB) Downloaded 8 times
These users thanked the author Lagoda for the post:
seokgi (Thu Aug 01, 2019 7:33 am)
Rating: 5.56%
 

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Tue Jul 30, 2019 11:25 pm

Unfortunately I do not know C Language.
Thank you for your interest.

I would like to have a deep interest in Matrix.

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Thu Aug 01, 2019 7:35 am

The above Hex file works very well.

However, FC8 does not work.

External Clock changed 11.0592mHz.

Lagoda
Posts: 141
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 60 times
Been thanked: 54 times
Contact:

Re: 18F67K40 UART Problem

Postby Lagoda » Thu Aug 01, 2019 2:51 pm

OK.
Then you are sure that your circuit is not faulty.

Have you ever tried to set the HighVoltage programming mode in Configuration Settings? (This is now set to LV in your test program.)
What type of programming tool do you use?

Lagoda
These users thanked the author Lagoda for the post:
seokgi (Fri Aug 02, 2019 1:38 am)
Rating: 5.56%
 

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Fri Aug 02, 2019 1:37 am

I have never tried high voltage programming.

And I use PICKIT3.

Thank you for your attention.

Lagoda
Posts: 141
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 60 times
Been thanked: 54 times
Contact:

Re: 18F67K40 UART Problem

Postby Lagoda » Fri Aug 02, 2019 7:13 am

I mean, try to disable the Low Voltage Programming mode. Sorry.

User avatar
LeighM
Matrix Staff
Posts: 1845
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 429 times
Been thanked: 612 times
Contact:

Re: 18F67K40 UART Problem

Postby LeighM » Fri Aug 02, 2019 2:38 pm

When you tried V0.9.fcfx (attached above, but with the lower frequency clock/crystal) with the LED icons enabled, did the LEDs flash?

User avatar
Benj
Matrix Staff
Posts: 14151
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4080 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Fri Aug 02, 2019 4:09 pm

Hello,

I have never tried high voltage programming.


Low voltage programming (LVP) IMO is a can of worms and best avoided at all costs if possible. Make sure you disable it in your configuration settings. PICkit via ICSP will use high voltage programming by default.

Best way to start debugging your hardware is to try this. It will confirm your device is running and if the UART baud rate has a chance of being correct.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Mon Aug 05, 2019 12:56 am

Crystal was replaced with 11.0592mHz.
I have confirmed that the program that flashes works.
The UART still does not work.
And how does RE3 and RG5 differ from the 18F67K40? RE3 works well as an output.
Attachments
스크린샷 2019-08-05 08.52.04.png
스크린샷 2019-08-05 08.52.04.png (49.36 KiB) Viewed 777 times

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Mon Aug 05, 2019 3:39 am

seokgi wrote:Crystal was replaced with 11.0592mHz.
I have confirmed that the program that flashes works.
The UART still does not work.
And how does RE3 and RG5 differ from the 18F67K40? RE3 works well as an output.


18LF67K40.fcdx is suspected.

Thank you.

Lagoda
Posts: 141
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 60 times
Been thanked: 54 times
Contact:

Re: 18F67K40 UART Problem

Postby Lagoda » Tue Aug 06, 2019 3:12 pm

Have you ever tried in your test enviroment to use only one UART component without LED components?

Lagoda

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Tue Aug 06, 2019 11:57 pm

Yes .
I tried it. But does not work.

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Wed Aug 07, 2019 12:23 am

I used the updated 18LF67K40.fcdx but uart still doesn't work. LED works well. The timer interrupt does not work either.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1089
Joined: Sun Oct 05, 2014 3:20 pm
Has thanked: 334 times
Been thanked: 544 times
Contact:

Re: 18F67K40 UART Problem

Postby QMESAR » Wed Aug 07, 2019 5:22 am

HI,
I would change the configuration settings for PPS from allow once to allow as needed

P1.jpg
P1.jpg (120.19 KiB) Viewed 641 times


P2.jpg
P2.jpg (104.91 KiB) Viewed 641 times

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Thu Aug 08, 2019 12:02 am

I ran as you advised but it still doesn't work.
  ~ MCLR doesn't seem to be related to RE3, but requires configuration in Project Options.
I don't know how to deal with the PCB already produced.
Thank you for your attention.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1089
Joined: Sun Oct 05, 2014 3:20 pm
Has thanked: 334 times
Been thanked: 544 times
Contact:

Re: 18F67K40 UART Problem

Postby QMESAR » Thu Aug 08, 2019 5:13 am

Hi.
well I am not sure what is going on here however in my understanding of the Datasheet MCLR is at pin RG5 and not RE3 as in the FC definition file and it seems one UART is using RE3

P1.jpg
P1.jpg (75.38 KiB) Viewed 611 times
These users thanked the author QMESAR for the post:
seokgi (Thu Aug 08, 2019 6:20 am)
Rating: 5.56%
 

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Thu Aug 08, 2019 6:19 am

I think the same thing. I'm waiting for a quick fix from Matrix.
thank you.

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Fri Aug 09, 2019 12:31 am

When will this problem be solved?
I hope you're interested in Matrix.

seokgi
Posts: 104
Joined: Fri Jan 13, 2012 4:21 am
Has thanked: 18 times
Been thanked: 10 times
Contact:

Re: 18F67K40 UART Problem

Postby seokgi » Mon Aug 12, 2019 11:57 am

Hi.
Benj.
When will this problem be solved? I can't do anything.
If this doesn't work, I'm in serious trouble. PCB is produced. Give a solution
Please help me.
Thank you.

User avatar
Benj
Matrix Staff
Posts: 14151
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4080 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Mon Aug 12, 2019 12:33 pm

Hello,

So we are on the same lines what exactly isn't working that you would like me to investigate.

From the looks of it UART comms is not working and timer interrupts are also not working? Is this correct?


Just been through the chip definition and both Timer0 and Timer1 look ok.

I've also been through the UART CAL comparing the register setup with a known working device and this also checks out.

So I'll wait for you to confirm the specific issue you've experienced.


In your project you have all AltTx and AltRx properties set to Yes, what happens if you set these to No.