PIC24FV32KA304 Uart is twice speed

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

Moderator: Benj

Post Reply
Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

PIC24FV32KA304 Uart is twice speed

Post by Jörg Güldner »

Hi MM,
the baudrate is twice speed I setup in the program. 9600 baud is for 1 bit on the oscilloscope 52us instead 104us.
Is there a setup mistake or a bug? My little program is attached.
The pic is connected to a external quarz on the primary oscillator.


Thanks in Advanced

Jörg
Attachments
UART_Test_PIC24FV32KA304_V6.fcfx
(21.91 KiB) Downloaded 334 times

User avatar
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: PIC24FV32KA304 Uart is twice speed

Post by Benj »

Hello Jörg,

It looks like this is related to a compiler bug, the FV devices don't seem to have the standard compiler definition.

I have added the definition to the header file for the chip which should solve the issue.

The file needs to be placed into this directory.

C:\Program Files (x86)\Flowcode 6\compilers\pic16\support\24F\h
p24FV32KA304.h
(160.37 KiB) Downloaded 343 times
Let me know how you get on.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: PIC24FV32KA304 Uart is twice speed

Post by Jörg Güldner »

Hello Benj,
baudrate is now OK. Well done.
Can you put the file in FC7 update, which appears next week?


Best regards
Jörg

User avatar
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: PIC24FV32KA304 Uart is twice speed

Post by Benj »

Hi Jörg

Is the bug present in Flowcode 7 too?

Flowcode 7 has a much newer compiler for 16-bit PIC so I would have hoped this would be fixed. If not then I'll have a sweep for other chips that might have this same issue.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: PIC24FV32KA304 Uart is twice speed

Post by Jörg Güldner »

Hello Benj,
I`ve baught FC7 already, but will wait for manual activation with the update coming out next week.
With this controller is just a project running. In the past I get in a bigger project one of the
I2C channels not running and wrote and own software part. Afterwords I read in the forum, that there was a problem
with switching over from analog in to ditital. If there will be problems anywhere, I will inform you, latest when
my FC7 is running.


Best regards
Jörg

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: PIC24FV32KA304 Uart is twice speed

Post by Jörg Güldner »

Hello Benj,
I found in the moment 2 more points for this controller.
01.) Setting an interrupt for timer4 with external clock is not working --> you must change this port-pin from analog to digital, then it`s running. Can you implementated this in your interrupt-box?
02.) External clock signals are counted with timer4. The interrupt of timer4 toggles a bit and write it to the port. That works! A additional pin write in a loop makes confusion. The timer
gets from writing to the port sometimes a additional signal??? Please have a look to the attachments. Maybe that there is a fundamental problem, because I have problems with the I2C, I already posted.
If you check the single function, all is working. But in conjunction with other functions comes the bugs.

In the program I use A10 for an output. If I replace the output-box A10 and place a c-Icon with "PORTA |= (1 << 10);" or "PORTA &= ~(1 << 10);" all is running well ?!?!?!?!?


Can you have a further look to them?



Best regards
Jörg
Attachments
Port problem_PIC24FV32KA304_V6.jpg
Port problem_PIC24FV32KA304_V6.jpg (63.03 KiB) Viewed 7433 times
Port problem_PIC24FV32KA304_V6.fcfx
(17.48 KiB) Downloaded 313 times

User avatar
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: PIC24FV32KA304 Uart is twice speed

Post by Benj »

Hello Jörg,

Looking at the C code generated here at the top of the Main function it looks like the ANSB register has already been cleared. Are you missing the top three lines of code? If so then do you have the latest release of Flowcode 6 installed?

Code: Select all

int main()
{
//Revert to digital IO
ANSA=0;
ANSB=0;
ANSC=0;

    // C-Code
    // C Code:
    ANSB = ANSB & 0b1111111111111011; // 0=digital

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: PIC24FV32KA304 Uart is twice speed

Post by Jörg Güldner »

Hello Benj,
to your latest answere and my post before:
1.) using an interrupt-box with timer x and external signals is not running. You must additional write in a c-box the command to change from analog to digital. My idea was to implementate this c-line into your
software from the interrupt-box. When you then choose external counts, the belonging port pin is correctly setup, too.

2.) my post before: here seems to be a bug, I think. Read it again, please. Counting in to timer4 and writing out a other signal to the same port generates sometimes a additional signal to the timer4. It`s only running when the output-box is disable and replace with the c-line for setting this port pin you can read there. There is a other phenomen with I2C where I write my own software I2C, who is running. All happens in conjunction with other moduls, where I could not find out why.

3.) Now I test again the I2C -->
a.) Channel 1 hardware 100KHz --> Initialize, Send byte transaction = no signals coming out !!!
b.) Channel 1 software 100KHz --> Initialize, Send byte transaction = no signals coming out !!!
c.) Channel 1 software 100KHz --> Initialize with my own software, Send byte transaction = Data signals are coming, no clock !!!
d.) My own software 100KHz --> Initialize writing by my own, Send with own software = Data and clocksignals are coming.

--> I´m using the lasted V6 and the corrected h-file where the uart before have no correct baudrate

Have you any idea?

Best regards

Post Reply