FC6 PIC24FJ256GB106 HW UART / SW UART Timing Bug?

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

Moderator: Benj

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

FC6 PIC24FJ256GB106 HW UART / SW UART Timing Bug?

Postby Rudi » Sun Mar 30, 2014 1:56 am

Hi
i try to get this run with HW UART but i think i make false or the Uart will make fun to me...;-) or i try a function that not gives..

If i try the RS232 with Channel example Channel 2.. the Tx and Rx connections will be grey and i can make Tx Remap Rx Remap
so i set this to PortG.6 and PortG.7..

I test my message but i get wrong characters.../ ..strings.. no indifikation to send Message.


If i try with "Software" in Properties, ( Channel --Software ) i will get my Message well,
the Tx and Rx in Properties will be the same like the Tx Remap and Rx Remap..

if i try with "Channel 1 or 2 or 3 or 4" in Properties ( Channel -- Channel 1....4 ) i will get not the right Message like i send.. ..no indifikation to SendMessage..
( Channel Channel 1 does not gives Resonse to the Pins... ) ..

Can someone tell me what i make wrong..

I have make a simple Hello World.

If i want a HW Uart i must Set in Properties in Channel Channel 1..4 right?

I try Channel 1..4 at pins example PortG.6 PortG.7 but i can not get the right Message
I try Software at pins example PortG.6 PortG.7 i can get the right Message.
hmm..

My question is ;-)

Is the "Software" Channel a HW Uart in this Chip Pack?

The Channel Channel 1..4 normaly this the 4 UART for the Chip PIC23FJ256GB106...
how i can make it with Channel 1..4? Why get i wrong Messages if i set this Channel 1..4?
..otherwise... must i take "Channel 1..4 " ? ...
Ok... ;-) i try a long Time in this.. i have check all ( config bits ) ... and i think i must ask this -
i do not know next steps... perhabs someone can give me the right doing for this..

Best Thank for reading and your help!

Best wishes

Rudi

;-)


Edit:

Example:
The Message is : Hello World
as Software i get the right
as Channel 2 i get ... 6x Chars in HEX were this : 82 C6 87 E1 C5 F4
this have no indifikation with my message Hello World


Edit2: OK I found next steps...
The Theme is : Peripheral Pin Select ( S. 129 )
http://www.microchip.com.tw/Data_CD/Dat ... 39905E.pdf
I will read in more...


Edit3:
The Theme is : Peripheral Pin Select ( S. 135 )
http://ww1.microchip.com/downloads/en/D ... 39897c.pdf
PIC24..GB-- Family... ( S. 135 )

..


Edit4: ;-(
If i take Software as Channel.. the pins Tx Rx i set PORTG.6 and PORTG.7 is ok
if i try Cannel as Channel ... the pins Tx Rx are grey as PORTG.6 and PORTG.7 and TX Remap RX Remap will be same but can edit.. Someone know how this go on? I will not get right Message at this Position.
Must i remap this then to a other PIN? .. my steps are broken.. ;-( ...
Last edited by Rudi on Thu May 15, 2014 4:08 am, edited 1 time in total.

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

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Benj » Mon Mar 31, 2014 11:29 am

Hi Rudi,

Please can you try this fix for me,

Please the attached file below into your "C:\Program Files (x86)\Flowcode 6\CAL" folder and try re-compiling using a hardware channel.

internals.c
(11.27 KiB) Downloaded 111 times


The problem seems to be related to the device clock speed which should be dividing by 2 to obtain the correct hardware baud rate.
These users thanked the author Benj for the post:
Rudi (Mon Mar 31, 2014 4:33 pm)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Mon Mar 31, 2014 4:52 pm

Benj wrote:Hi Rudi,

Please can you try this fix for me,

Please the attached file below into your "C:\Program Files (x86)\Flowcode 6\CAL" folder and try re-compiling using a hardware channel.

The problem seems to be related to the device clock speed which should be dividing by 2 to obtain the correct hardware baud rate.



Hi Benj ;-)

thank you so much for your great Service!!!

I have try and...
have a look to the pic
i have set HW Uart Channel 2 to 9600 and sets pin to Tx ( G6 ) Rx ( G7 )
SendString("Hello World!\r\n")

In Terminal wtih 9600 comes in Hex Translate: 82 C6 87 E1 C5 84 62

In Terminal with 19200 comes ;-))) : Hello World!
In Hex Translate : 48 65 6C 6C 20 57 6F 72 6C 64 21 0D 0A

This is a Begin ;-))) benj "you are simple the Best!!!"
How can we managed this finnaly? I will test your Tips...

I have attached the example i made..
Config Register i set again to
Config3 0xFFFF
Config2 0x23FE
Config1 0x3E7F

Clock Speed is setting to 32 MHz ( the 1 sec delay is ok )
On Board i have a 12MHz Crystal ..
If you need detaile Info i can attached Shematic of Board.

Thank you Benj!

Best wishes

Rudi

;-)


Edit:
Benj I test tihs too now.. with

FC6 HW Uart Baud - > Terminal Bauds..
..
19200 -> 19200 not ok ... 38400 ok
57600 -> 57600 not ok ... 115200 ok
..
best wishes..
Rudi
;-)
These users thanked the author Rudi for the post:
Benj (Mon Mar 31, 2014 4:59 pm)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Mon Mar 31, 2014 7:09 pm

Sorry for Push Benj,

i have test with setting a config bit...
normally the Board is 12MHz ..
i have test with set the Bit at Bit 28-30 ..
Oscillator input divided by 6 ( 24 MHz input )

The Hw Uart i set to 57600 and in Terminal too.
Now the Baudrate are corect - but the delay 1s in programm is double.. ( 2 s )
i will check the internals.c...
in internals.c
#ifndef MX_CLKS_PER_INST
#define MX_CLKS_PER_INST 2
#endif

---



so i have test with ( changed 2 in 4 )

Code: Select all


#ifndef MX_CLKS_PER_INST
         #define MX_CLKS_PER_INST 4
      #endif



and the Baudrate in HW Uart 57600 is ok in Terminal 57600 ok too and the 1 s delay in proramm is ok too...

but i understand the config bit 28-30 not why this div 6 ( 24 MHz ) .. i have a 12 MHz at Board ;-))..
..
ok perhabs you know more about..
i will test more ...

i will change the clk from 32 MHz to 12 MHz.
bit 28-30 ..div 6 (24 MHz )
the Baudrate are now..
HW Uart 57600 --- Terminal 128000 ... and 1s delay prog is... ca. 1/2 sec
in internals.c
#ifndef MX_CLKS_PER_INST
#define MX_CLKS_PER_INST 4
#endif

....


i will change the clk to 32 MHz
bit 28-30 ..div 3 ( 12 MHz )
the Baudrate are now ...
HW UArt 57600 -- Terminal 115200 ... and 1s delay prog is .. 1s delay

in internals.c
// #ifndef MX_CLKS_PER_INST
// #define MX_CLKS_PER_INST 4
// #endif

...

;-)



Best wishes..
Rudi

;-)


Edit Again:
Ok Benj... have a look to the pic please, i have test arround ...
the time difference i will make in programm for first Time.
do you know what's going on here? ;-)
i am sure, the Board has a 12 MHz Crystal ;-)))
..
ok here my tests... i have change in Project and change in internals.c..

Thank you for your Time and Service perhabs you can check this again and perhabs you have a workarround for this..
Best wishes

Rudi
;-)


..

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Tue Apr 01, 2014 2:21 pm

Sorry For Push

I test just in Time same PIC but i have at this Board a 20 MHz Crystal..
Clk Speed 8000000Hz
Oscillator input divided by 5 ( 20 MHz )

Config3: 0xFFFF
Config2: 0x43BE
Config1: 0x3E7F


I have then set all to Channel 2 , Baudrate 9600 works..
I have change to Channel 3 ( same baud ... same pins.. ) and this work
i have change to channel 4 ( same baud ... same pins.. ) and this work
i have change to channel 1 ( same baud ... same pins..) and this work


so i test next baudrate...

Channel 1
Channel 2
Channel 3
Channel 4

Baudrate 115200 in FC Prog - > real in Terminal to read Messages : at 128000
Baudrate 57600 in FC Prog -> real in Terminal to read Messages : NO Chance
Baudrate 38400 in FC Prog -> real in Terminal to read Messages : NO Chance
Baudrate 19200 in FC Prog -> real in Terminal to read Messages : NO Chance
Baudrate 9600 in FC Prog -> real in Terminal to read Messages : at 9600

Whats going on ;-(

One is allways the Same:
The TimerTick is in Programm ( delay 1s ) real 2 s.

i have read in code detailed and found a Hint at Microchip like this..:

Code: Select all


#if defined(__PIC24F__)   
   // PIC24F processor
   #define GetSystemClock()      (32000000ul)      // Hz
   #define GetInstructionClock()   (GetSystemClock()/2)
   #define GetPeripheralClock()   GetInstructionClock()

#endif





ok this i think was the append in internals.c ( / 2 ) ..for int


Code: Select all


   #ifndef MX_CLKS_PER_INST
         #define MX_CLKS_PER_INST 2
      #endif






next i find ..

this will be the Timer Tick in 1 S -> 2 S



Code: Select all

#if defined( __C30__ )
    #ifdef USE_FRC
        #define GetSystemClock()            32000000UL
        #define GetPeripheralClock()        (GetSystemClock())
        #define GetInstructionClock()       (GetSystemClock() / 2)
        #define MILLISECONDS_PER_TICK       10
        #define TIMER_PRESCALER             TIMER_PRESCALER_8 //TIMER_PRESCALER_1
        #define TIMER_PERIOD                20000 //40000
    #else
        #ifdef GO_SLOW
            #define GetSystemClock()            8000000UL
            #define GetPeripheralClock()        (GetSystemClock())
            #define GetInstructionClock()       (GetSystemClock() / 2)
            #define MILLISECONDS_PER_TICK       10
            #define TIMER_PRESCALER             TIMER_PRESCALER_1
            #define TIMER_PERIOD                40000
        #else
            #define GetSystemClock()            32000000UL
            #define GetPeripheralClock()        (GetSystemClock())
            #define GetInstructionClock()       (GetSystemClock() / 2)
            #define MILLISECONDS_PER_TICK       10
            #define TIMER_PRESCALER             TIMER_PRESCALER_8   // 8MHz: TIMER_PRESCALER_1
            #define TIMER_PERIOD                20000                // 10ms=20000, 1ms=2000
        #endif




Where i can add this "Timer_Period" settings in FC6 so i think the 1s-2s will fixed..


And how can go on the Baudrate Mistakes..

i read detailed in so is there a possible to check this ..

Code: Select all


// Define the baud rate constants
#if defined(__C30__)
    #define BAUDRATE2       57600UL
    #define BRG_DIV2        4
    #define BRGH2           1
#elif defined (__PIC32MX__)
    #define BAUDRATE2       115200ul
    #define BRG_DIV2        4
    #define BRGH2           1
#endif




Ok... I will paused at this.. because this Baudrate Theme is damaged me ;-) and make no fun..
.. someone a hint? grr... this Theme .. i do not come on...

Best wishes

Rudi
;-)

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

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Benj » Tue Apr 01, 2014 2:36 pm

Hello Rudi,

Please can you try the attached FCD for me. Hopefully it should work correctly for you.

24FJ256GB106.fcdx
(37.55 KiB) Downloaded 88 times

24FJ128GB106.fcdx
(37.55 KiB) Downloaded 85 times


You need to get the config and project options clock speed setup correctly so that 1s delays = 1 second delays on the hardware. This means the clock and config is setup correctly.

Next with the new FCD copied into the "C:\Program Files (x86)\Flowcode 6\FCD\PIC16" directory restart Flowcode and hopefully the baud rates should now be correct.

If this makes things 2 x worse then try editing the line in the FCD as follows, it's right near the bottom of the file.

From:

Code: Select all

 <defines code='#define MX_CLKS_PER_INST 4\n' />


to this:

Code: Select all

<defines code='#define MX_CLKS_PER_INST 1\n' />


Let me know how you get on.
These users thanked the author Benj for the post:
Rudi (Tue Apr 01, 2014 4:12 pm)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Tue Apr 01, 2014 3:02 pm

Benj wrote:Hello Rudi,

Please can you try the attached FCD for me. Hopefully it should work correctly for you.

24FJ256GB106.fcdx

24FJ128GB106.fcdx


You need to get the config and project options clock speed setup correctly so that 1s delays = 1 second delays on the hardware. This means the clock and config is setup correctly.

Next with the new FCD copied into the "C:\Program Files (x86)\Flowcode 6\FCD\PIC16" directory restart Flowcode and hopefully the baud rates should now be correct.

If this makes things 2 x worse then try editing the line in the FCD as follows, it's right near the bottom of the file.

From:

Code: Select all

 <defines code='#define MX_CLKS_PER_INST 4\n' />


to this:

Code: Select all

<defines code='#define MX_CLKS_PER_INST 1\n' />


Let me know how you get on.



Hi Benj,

first thank you for your Service!!!
I have try the first.. have a look to the pics..
i will try *now the second... ..till later...
^^^
Edit: Know in now ;-)

;-)
Rudi
Last edited by Rudi on Tue Apr 01, 2014 6:32 pm, edited 1 time in total.

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Tue Apr 01, 2014 3:51 pm

Hi Benj -
my latain is finnished ;-) ;-) ;-)

I will test arround again next times with more tests.. whats going with this PIC24 or Baudrate ;-) ;-) ?
..i have added pics..

Thank you for your great Service!!!

PS.
I added original Wifi Webserver Code too.
Also the Circuit / Shema of the Board.

Best wishes!
Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Tue Apr 01, 2014 7:18 pm

Sorry for Push,

Code: Select all


                           1sDelay
FC6   TERM            HWDelay       INT   Clock   Config Bit
-----------------------------------------------------------------------
9600   2400   can read    1.031   INT 16   32MHz   div5 ( 20MHz )
9600   2400   can read   2.031   INT 8   32MHz   div5 ( 20MHz )
9600   2400   can read   4.031   INT 4   32MHz   div5 ( 20MHz )
9600   ----   no read      1.5   INT 4   12MHz   div5 ( 20MHz )
9600   ----   no read      2.5   INT 4   20MHz   div5 ( 20MHz )
9600   9600   can read   1.0   INT 4    8MHz   div5 ( 20MHz )

19200   ----   no read      1.0   INT 4    8MHz   div5 ( 20MHz )




I think i must for RS232 change Crystal to Intern 8 MHz
change Clock to 32 MHZ and setting Config Bit to div5 20 MHz but the config bit is not possible to set ...

Best wishes
Rudi
;-)


User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed Apr 02, 2014 10:25 am

Benj wrote:Hello Rudi,

Please can you try the attached FCD for me. Hopefully it should work correctly for you.

24FJ256GB106.fcdx

24FJ128GB106.fcdx




Hi Benj,
ty for your great service!
I have try today again, please have a look to the second fcdx
i have read in this file without see the name of file, i have think this is a update for the first attached file...
i found a config name to the FJ128..
so i wounder me at first time.. but then i see the file name for FJ128 and then i think this is right... one for the FJ256 and one for the FJ128
I only ask retoure.. the first fcdx is for the FJ256 .and the second for the FJ128.. is it so ok?

only for control:

device name
A) 24FJ256GB106
B) 24FJ128GB106

flashbyte
A) FJ256= 262144
B) FJ128= 131072

ram bytes
A) FJ256= 16384
B) FJ128= 16384

config adress
A) FJ256= 0x2ABFA
B) FJ128= 0x157FA


Please check this: ;-)
in your new internals.cal

Code: Select all

#ifndef MX_CLKS_PER_INST
         #define MX_CLKS_PER_INST 2
#endif


must this
ifndef
^
correct in

Code: Select all


#ifdef MX_CLKS_PER_INST
         #define MX_CLKS_PER_INST 2
#endif


and a other question:

this line has the same function like the "inline" in the fcdx file?

Code: Select all


<inline>
  <defines code='#define MX_CLKS_PER_INST 4\n' />



i have understand the value of 2 and the value of 4
if runs 1s delay to fast i will change to 2 this..

which "rules" is at first in the compiler?
does the compiler take the internals.c first time and then the device file / ( fcdx )
i ask, because if i have in internals.c the int 2
and in the inline the int 4
which number will taken in the hex?
;-)
i hope i have describe correct the thinking about ..

Benj.. can you check the "#ifndef" "#ifdef" i think there is a mistake to the n right?

i put then all two in the folder like it is..

ok.. i will try again today other step by step too..:

i will flash the pic with the original hex that runs usb as a CDC and UART at 19200.
so the board is config well.

then i will make a simply project with usb serial, without save config byte to the board,
so the original byte will not delete i think. ( but how is the code making with fcdx inlines... and change internals.c ..)

So USB Serial must go on and the UART with 19200 must run.. right?
;-) i will try...and write how this run.. ...

Best wishes!
and ty
Rudi
;-)

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

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Benj » Wed Apr 02, 2014 11:13 am

Hi Rudi,

The FCD sets the MX_CLKS_PER_INST definition, however not all FCDs have this define.

So the internals file is used as a catch all and says if not defined (#ifndef) then define it as divide by 2.

As long as the PIC24FJ FCDs set the #define MX_CLKS_PER_INST 1 then all should be ok.
These users thanked the author Benj for the post:
Rudi (Wed Apr 02, 2014 11:17 am)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed Apr 02, 2014 11:21 am

Benj wrote:Hi Rudi,

The FCD sets the MX_CLKS_PER_INST definition, however not all FCDs have this define.

So the internals file is used as a catch all and says if not defined (#ifndef) then define it as divide by 2.

As long as the PIC24FJ FCDs set the #define MX_CLKS_PER_INST 1 then all should be ok.


Hi Benj,
ty,
only back ask:
i set the #define MX_CLKS_PER_INST 1
in the FCD File right?
because in internals.c
if"not"def
will set the int == 2
right?
;-)
Best wishes!
Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed Apr 02, 2014 1:38 pm

Hi Benj,

at First Again!!!

Best Thank You for your Best Service i ever have seen!!!
You are a hardwork liner!
I wish to meet you in future at next FC Demonstration in Germany if you will be there..for a Technical discussion..
ok..

Benj, One things go wrong here ..

i think the baudrate generator is not working correctly but i do not find the mistake ..but i have make many tests and noted the results for you..
my tests i will write you all in a report here next 1-2 hour.. i make a pause now..

shortly Info:
==========

usb serial ... now working! ;-) ;-) ;-) ;-) ;-) ;-)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Edit: Only Initialize Benj... sorry for fast submit..
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SendString "Hello World!\r\n" is not arrival .. no data arrival at Terminal..
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ênd edit



i have "delete" the internals.c ifndef and in the fdc the inline... because i have set in chip config clk at 32000000 MHz and set config bit at config2 to 0x43BE..( bit 28-30 Oscillator input div by 5 ( 20MHz ) to write to chip..

the 1s delay = 1s delay .. same you sayed... but yesterday this not worked.. i do not know why.. i will test again the same procedure from yesterday today later time..--
i want test ...the ifndef or/and inline fdc perhabs goes cross .. i will check it again benj... so you will know what s going on...

btw: the ifndef / inline description .. this is the same in Bit setting at 28-30 ? ..( input div by...) if i set config bit to chip right?..



i am happy ;-))
^^^^^^^^^^^^

..usb serial know working..with 32000000Hz clock and config2 : 0x43BE ( bit 28-30 OSc inp div by 5 ( 20 MHz )
the board has a 20 MHz..

this will also go on.. i am sure:
-------------------------------------

but i get no right message at UARTS...
but!
if i make a RS232 with 9600
the delay 1s = 1s
usb serial works..
but in terminal i must set to 19200..then i get right message "Hello World!\r\n"

do you know just in time whats going on with baudrate?
.. i will report my test in 1-2 hour .. i make a pause..
long night and early day.. ;-)

ok ..

till later

Best wishes
Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed Apr 02, 2014 2:10 pm

Edit: Only Initialize Benj... sorry for fast submit..
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SendString "Hello World!\r\n" is not arrival .. no data arrival at Terminal..
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ênd edit


;-)..

rudi

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed Apr 02, 2014 7:14 pm

Rudi wrote:Hi Benj,

if i make a RS232 with 9600
the delay 1s = 1s
usb serial works..
but in terminal i must set to 19200..then i get right message "Hello World!\r\n"

do you know just in time whats going on with baudrate?




Ok..
a short list..all other not runs i cut...
runs at 32000 only 2400, 4800 and 9600..

( how i can formated this in forum )
..


Code: Select all


Clock Speed   INT   Delay   Baudrate   CanReadDataRight
32000000   1   16   19200   no
8000000   1   4   19200   no
8000000   2   2   19200   no

8000000   2   2   9600   yes
8000000   4   1.015.6   9600   yes

8000000   4   1.015.6   4800   yes

8000000   4   1.031.3   2400   yes

8000000 4   1.015.6   38400   no



Best wishes
Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Fri Apr 04, 2014 4:17 am

Hi,

i have make one more tests with HW Uart and Software Uart...

i see a Reversal Handle at clk speed 32000000 with MX_CLKS_PER_INST = 2...
this is the option as the 1s delay in software is 1s delay at hardware..
so i think the timing is ok...

have a look to the pics...
sorry for the big...
i do not know how i can make a formated List or table in Forum.. so i hope you can pick the details you need for see whats going on with trhe UART Ghost ;-)

a question: what does UART have that USB not go on... is it possible that is a "Concatenation with this" ?
ok... i hope you can detailed pick infos from picture.. ( i have over 160 test in this and 138 burns ;-) .. i make pause at this theme ..
please have a look to the PIC16Bit_CAL_UART.c... i mean there is a mistake in formula?


UART Section ( Side 9 )
http://ww1.microchip.com/downloads/en/DeviceDoc/en026583.pdf


Thank you for your Service!
Best wishes!
Rudi
;-)


ps..
i am not sure!!
....................
but can you check this?


( Pic16Bit_Cal_Uart.c )

Code: Select all

                  
 #if defined(MX_UART_CHANNEL_1) && (MX_UART_NUM==1)                  
   #if (MX_UART_CHANNEL_1 == 0)               
                  
      #define MX_SOFT_BAUD_1 (1000000 / MX_UART_BAUD_1) - SW_OFFSET            
                  
      #if (MX_SOFT_BAUD_1 < 1)            
         #error "Software UART Baud Rate Not Available At This Clock Speed"         
      #endif            

   #else               
      #define MX_SOFT_BAUD_1   1         

      #if defined(dsPIC33) || defined(PIC24)            
// orig   #define MX_HARD_BAUD_1   (((MX_CLK_SPEED / MX_UART_BAUD_1) - 16) / 32)            
// Rudi 4.4.2014                  
   #define MX_HARD_BAUD_1   ((MX_CLK_SPEED / MX_UART_BAUD_1) / 16) - 1            
   
   #else            
         #define MX_HARD_BAUD_1   (((MX_CLK_SPEED / MX_UART_BAUD_1) - 16) / 64)      
      #endif            
   #endif               
 #endif                  
                  


....

....
...
...


...


Code: Select all

                  
                  
//Hardware Baud update definitions                  
#ifndef MX_HARD_BAUD_CHANGE_DEFS                  
   #define MX_HARD_BAUD_CHANGE_DEFS               
// Rudi 4.4.2014                  
   #define MX_HARD_BAUD_1200   ((MX_CLK_SPEED / 1200) / 16 ) - 1            
   #define MX_HARD_BAUD_2400   ((MX_CLK_SPEED / 2400) / 16 ) - 1            
   #define MX_HARD_BAUD_4800   ((MX_CLK_SPEED / 4800) / 16 ) - 1            
   #define MX_HARD_BAUD_9600   ((MX_CLK_SPEED / 9600) / 16 ) - 1            
   #define MX_HARD_BAUD_19200   ((MX_CLK_SPEED / 19200) / 16 ) - 1            
   #define MX_HARD_BAUD_38400   ((MX_CLK_SPEED / 38400) / 16 ) - 1            
   #define MX_HARD_BAUD_57600   ((MX_CLK_SPEED / 57600) / 16 ) - 1            
   #define MX_HARD_BAUD_115200   ((MX_CLK_SPEED / 115200) / 16 ) - 1            
                  
// Original                   
//   #define MX_HARD_BAUD_1200   (((MX_CLK_SPEED / 1200) - 16) / 64)            
//   #define MX_HARD_BAUD_2400   (((MX_CLK_SPEED / 2400) - 16) / 64)            
//   #define MX_HARD_BAUD_4800   (((MX_CLK_SPEED / 4800) - 16) / 64)            
//   #define MX_HARD_BAUD_9600   (((MX_CLK_SPEED / 9600) - 16) / 64)            
//   #define MX_HARD_BAUD_19200   (((MX_CLK_SPEED / 19200) - 16) / 64)            
//   #define MX_HARD_BAUD_38400   (((MX_CLK_SPEED / 38400) - 16) / 64)            
//   #define MX_HARD_BAUD_57600   (((MX_CLK_SPEED / 57600) - 16) / 64)            
//   #define MX_HARD_BAUD_115200   (((MX_CLK_SPEED / 115200) - 16) / 64)            
#endif                  
                  





ty...

Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Fri May 09, 2014 4:57 pm

Hi Benj,

i have make many try in this.. and i think i have found the Base...

my think was, why this go in software mode at 16000000 with 1..
but not in hardware mode...

i have make test with Time Factor Base..... with delay now.
there is a change if take "s" .. and if take "ms"...

a delay of 1s is not the same like a delay of 1000ms...
..
the factor #define MX_CLKS_PER_INST
have no function in ms but in sec

viewtopic.php?f=54&t=14797

Hope this helps

Best wishes!
Rudi
;-)

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Tue May 13, 2014 2:49 pm

?

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART P P S

Postby Rudi » Wed May 14, 2014 10:56 pm

Hi
there is a context for timing bug?

viewtopic.php?f=54&t=14797

regards
Rudi

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: FC6 PIC24FJ256GB106 HW UART / SW UART <GONE>

Postby Rudi » Fri May 23, 2014 3:23 pm

Actually FC 6.0.7.0
================

New Installed and update with the work on at the PIC16BIT_CAL_UART.c

Jac was working at this...

Read Details:
viewtopic.php?f=7&t=14818&p=60115#p60114

You find in this Thread the File.. as Attached as an update of PIC16BIT_CAL_UART.c that should fix my baud rate issues

here shortly :
download/file.php?id=14745

backup your actually PIC16BIT_CAL_UART.c
update your PIC16BIT_CAL_UART.c


I test just in Time now in UART in HW Mode
Baudrate issues is gone!

i will test next Time UART in SW Mode too, but i think is gone too.. if not i will write again a Info ;-)

Best Thank Jac!

Rudi
;-)


info:

this entry for (__dsPIC33E__) || defined(__dsPIC33F__) || defined(__PIC24E__) || defined(__PIC24F__) || defined(__PIC24H__)

was missed....
// *****************Jac ..>

//Hardware Baud update definitions
#ifndef MX_HARD_BAUD_CHANGE_DEFS
#define MX_HARD_BAUD_CHANGE_DEFS
#if defined(__dsPIC33E__) || defined(__dsPIC33F__) || defined(__PIC24E__) || defined(__PIC24F__) || defined(__PIC24H__)
#define MX_HARD_BAUD_1200 (((MX_CLK_SPEED / 1200) - 16) / 32)
#define MX_HARD_BAUD_2400 (((MX_CLK_SPEED / 2400) - 16) / 32)
#define MX_HARD_BAUD_4800 (((MX_CLK_SPEED / 4800) - 16) / 32)
#define MX_HARD_BAUD_9600 (((MX_CLK_SPEED / 9600) - 16) / 32)
#define MX_HARD_BAUD_19200 (((MX_CLK_SPEED / 19200) - 16) / 32)
#define MX_HARD_BAUD_38400 (((MX_CLK_SPEED / 38400) - 16) / 32)
#define MX_HARD_BAUD_57600 (((MX_CLK_SPEED / 57600) - 16) / 32)
#define MX_HARD_BAUD_115200 (((MX_CLK_SPEED / 115200) - 16) / 32)

//********************************<.. JAC


#else
#define MX_HARD_BAUD_1200 (((MX_CLK_SPEED / 1200) - 16) / 64)
#define MX_HARD_BAUD_2400 (((MX_CLK_SPEED / 2400) - 16) / 64)
#define MX_HARD_BAUD_4800 (((MX_CLK_SPEED / 4800) - 16) / 64)
#define MX_HARD_BAUD_9600 (((MX_CLK_SPEED / 9600) - 16) / 64)
#define MX_HARD_BAUD_19200 (((MX_CLK_SPEED / 19200) - 16) / 64)
#define MX_HARD_BAUD_38400 (((MX_CLK_SPEED / 38400) - 16) / 64)
#define MX_HARD_BAUD_57600 (((MX_CLK_SPEED / 57600) - 16) / 64)
#define MX_HARD_BAUD_115200 (((MX_CLK_SPEED / 115200) - 16) / 64)
#endif
#endif

...