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:

Re: 18F67K40 UART Problem

Postby seokgi » Mon Aug 12, 2019 3:30 pm

Benj wrote: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?

Yes !! Collect.

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

It is not working.

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.

I tried UART changed pin number. But that is not working.
I don't know how change UART CAL.



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


Looks same problem.

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: 4079 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Mon Aug 12, 2019 3:43 pm

Hello,

Thanks for getting back to me. Let's start with the timers. Do you have a simple program to test the timers I can look at? Just in case you have anything specific in your program that is causing a problem. Which timers have you tried?

I'll have another pass through the generated code and the datasheet just to make sure I've not missed anything.

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 13, 2019 5:54 am

Thanks for the quick response
I send a program to test.
I tried changing the timer in Interval, but it still doesn't work. And UART doesn't work either. If you operate the UART pin with LED, it works well.
Thank you.
Attachments
V0.901.fcfx
(22.93 KiB) Downloaded 9 times

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: 4079 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Tue Aug 13, 2019 12:56 pm

Hello,

You are using the Heart macro for the timer interrupt and again inside your main loop.

Try this simple test instead, does this count up on the LED array, should be at approx 10Hz.

TimerTest.fcfx
(23.37 KiB) Downloaded 23 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 » Wed Aug 14, 2019 1:09 am

Thank you very much for your help.
I got a message that the versions are different, so I removed the FC8 and downloaded and installed it.
It works fine. However, UART and Interrupt does not work for Timer 2, Timer 4, Timer 6, and Timer 8.

thank you for helping.

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 16, 2019 9:17 am

Dear Benj
I search here every day. I am in a very difficult position.
I hope to resolve the UART issue soon.
If I can't solve it next Monday, I'll have to pay a penalty.
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: 4079 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Fri Aug 16, 2019 12:02 pm

Hello,

Right I believe I've fixed the timer 2, 4, 6, 8 issue now and pushed the update to the system.

Can you send us an example of your UART project and I'll have another look at this for 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 16, 2019 2:22 pm

Hi Benji!
The timer seems to be working well.

But the UART doesn't work at all.
Upload the test program.


Thank you.
Attachments
ComTest.fcfx
(24.08 KiB) Downloaded 8 times

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: 4079 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Fri Aug 16, 2019 3:49 pm

The UART registers look OK to me.

The device does allow you to disable the peripheral clock and also the UART modules via the PMD0 and PMD5 registers. However the default for these should be enabled.

You can check this will the following C code before you initialise the UARTs.

Code: Select all

PMD0 = 0;
PMD5 = 0;


Is anything coming out of the TX pin? e.g. if you connect a LED does it flash or stay lit? Do you have access to a scope? Maybe it's working but at the wrong baud?

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 16, 2019 4:12 pm

I changed the source as you advised, but the UART still doesn't work.

Thank you.
Attachments
ComTest.fcfx
(24.21 KiB) Downloaded 6 times
These users thanked the author seokgi for the post:
Benj (Fri Aug 16, 2019 4:41 pm)
Rating: 5.56%
 

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: 4079 times
Contact:

Re: 18F67K40 UART Problem

Postby Benj » Fri Aug 16, 2019 4:40 pm

Have you tried a single UART at a time?

Also

Is anything coming out of the TX pin? e.g. if you connect a LED does it flash or stay lit? Do you have access to a scope? Maybe it's working but at the wrong baud?

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 » Sat Aug 17, 2019 1:19 am

Yes I tried it.

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 » Sun Aug 18, 2019 2:12 am

Yes
I tried it, but the UART still doesn't work.
The TX port outputs nothing. I looked at scope but there is no output.
There is nothing wrong with the circuit. LED does not blink even if UART is operated one by one.


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 » Tue Aug 20, 2019 9:46 am

I made an update today. However, the UART still doesn't work.
The hex file uploaded by Lagoda above works fine.

I'm sorry, but can you send me a UART example program for the PIC18F67K40 MCU?

I will wait for your help. 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 » Wed Aug 21, 2019 9:55 am

Try this test program. Port C6 is the output of UART TX.

Is it working?

Lagoda
Attachments
Seokgi_UART_Test.fcfx
(8.09 KiB) Downloaded 7 times
These users thanked the author Lagoda for the post:
seokgi (Thu Aug 22, 2019 6:26 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 22, 2019 4:43 am

Thank you for your attention.
UART does not work with the file you sent.
The HEX file you sent last time works fine.
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 » Thu Aug 22, 2019 5:53 pm

Hi Seokgi,

I set the transmission speed to 115200 baud. I think have you seen that.
I'm sorry it doesn't work. I would like to use this MCU in the future.

Just an idea (This is what I do when any peripheral is not working properly.):

Create a very simple program in Flowcode that handles the periphery being studied (eg UART).
You might want to try debugging the Flowcode generated C file in the MPLAB X IDE development environment. (If you have never used MPLAB X, it may take some time to get to know it. :wink: )
This method allows you to monitor the contents of the MCU's internal registers. This way you can tell the developers of Flowcode, which internal register content is incorrect. Maybe you can get a solution to the problem faster.
You do not need to know C language for this. (I can't program in C language.:( :( )

Best Regards,

Lagoda
These users thanked the author Lagoda for the post:
AbhijitR (Fri Aug 23, 2019 2: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 » Mon Aug 26, 2019 7:32 am

Dear BENJ!
I'm trying a lot but I can't solve it. There is a lot of pressure from our customers. I must solve this problem.
Give me a solution, maybe because I'm not good at English. Please understand.
Please ask.
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 » Tue Aug 27, 2019 11:35 am

Dear Benj.
I have tested the PIC18F67K40 several times. But it doesn't work yet. So I and my customers want to know when this problem will be solved, and if it doesn't work out quickly, I would like to use six UARTs using the PIC24FJ256GA406 in a 16-bit PIC. So I bought Pic Toolchain today. Is my choice right? Or is there a problem with this MCU? Especially UART and Interrupt. If this MCU has a problem, can you introduce another MCU?

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 27, 2019 1:44 pm

Hi Seokgi,

I'm using the PIC24FJ256GA106 and PIC24FJ256GA110 MCUs.
UART, SPI, ADC, PWM peripherals work perfectly in these devices. (I only use these peripherals at the moment.)
I use INT0, UART RX and Timers interrupts. They are working perfectly too.

That's a good choice, I think.

Lagoda
These users thanked the author Lagoda for the post:
seokgi (Wed Aug 28, 2019 12:43 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 » Wed Aug 28, 2019 12:42 am

Dear Lagoda!
I am so thankful for your kindness.
What I can help you with is that you can do some circuit design.
I can obviously help you in this part. I use eagle cad

I have a question.
I downloaded and installed the XC16 compiler but it did not compile. Can you tell me how to set it up here?
I'm using PICKIT3, PICKIT4, ICD3.

Once again thank you for your kindness.

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 » Wed Aug 28, 2019 10:25 am

Hi,

In my experience, the compiler can be used immediately after installation.
See the WIKI for help selecting and configuring the programmer.
https://www.matrixtsl.com/wiki/index.php?title=Supporting_Third_Party_Programmlsing_Tools

I took a closer look at the PIC24FJGA406 MCU. It has a very rich set of internal peripherals. :shock:
I do not know what the circuit to be developed should do and what internal peripherals you should use, but a modest set of peripherals might be sufficient.
The PIC24FJ256GA106 might be a better choice. (If it meet your expectations.)

Best Regards,

Lagoda
These users thanked the author Lagoda for the post:
seokgi (Fri Aug 30, 2019 3:05 am)
Rating: 5.56%