Page 2 of 2

Re: 18F67K40 UART Problem

Posted: Mon Aug 12, 2019 3:30 pm
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Mon Aug 12, 2019 3:43 pm
by Benj
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.

Re: 18F67K40 UART Problem

Posted: Tue Aug 13, 2019 5:54 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Tue Aug 13, 2019 12:56 pm
by Benj
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 228 times

Re: 18F67K40 UART Problem

Posted: Wed Aug 14, 2019 1:09 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 9:17 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 12:02 pm
by Benj
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.

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 2:22 pm
by seokgi
Hi Benji!
The timer seems to be working well.

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


Thank you.

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 3:49 pm
by Benj
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?

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 4:12 pm
by seokgi
I changed the source as you advised, but the UART still doesn't work.

Thank you.

Re: 18F67K40 UART Problem

Posted: Fri Aug 16, 2019 4:40 pm
by Benj
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?

Re: 18F67K40 UART Problem

Posted: Sat Aug 17, 2019 1:19 am
by seokgi
Yes I tried it.

Re: 18F67K40 UART Problem

Posted: Sun Aug 18, 2019 2:12 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Tue Aug 20, 2019 9:46 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Wed Aug 21, 2019 9:55 am
by Lagoda
Try this test program. Port C6 is the output of UART TX.

Is it working?

Lagoda

Re: 18F67K40 UART Problem

Posted: Thu Aug 22, 2019 4:43 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Thu Aug 22, 2019 5:53 pm
by Lagoda
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

Re: 18F67K40 UART Problem

Posted: Mon Aug 26, 2019 7:32 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Tue Aug 27, 2019 11:35 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Tue Aug 27, 2019 1:44 pm
by Lagoda
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

Re: 18F67K40 UART Problem

Posted: Wed Aug 28, 2019 12:42 am
by seokgi
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.

Re: 18F67K40 UART Problem

Posted: Wed Aug 28, 2019 10:25 am
by Lagoda
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.ph ... sing_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