Bringing up a new chip 18f24k50 Having some problems. Resolved use OSCCON and not OSCFREQ.
Moderator: Benj
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Bringing up a new chip 18f24k50 Having some problems. Resolved use OSCCON and not OSCFREQ.
I gave up on the other chip, was getting no support from FC.
I went with the 18f24k50 and I have it sort of running but it is really slow. I have tried to set the config but I must be doing something wrong.
Does any one have a screen shot of the config settings, the clock speed under general and if the internal Oscillator helper is needed with this chip.
I am trying to set it to 48mhz using the internal oscillator at some point I want to play with the usb on the chip.
Thanks,
Chad
I went with the 18f24k50 and I have it sort of running but it is really slow. I have tried to set the config but I must be doing something wrong.
Does any one have a screen shot of the config settings, the clock speed under general and if the internal Oscillator helper is needed with this chip.
I am trying to set it to 48mhz using the internal oscillator at some point I want to play with the usb on the chip.
Thanks,
Chad
Last edited by chad on Mon Oct 19, 2020 4:50 pm, edited 1 time in total.
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Hi Chad
try this setting, so your PIC is running on 48Mhz and a note: there is a similar PIC 18F25k50 with more ram for the same price.
regards
Stefan
try this setting, so your PIC is running on 48Mhz and a note: there is a similar PIC 18F25k50 with more ram for the same price.
regards
Stefan
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Hi Stefan,
That's how I set it up.
Thanks for double checking my settings.
On the bigger chip. I realized that as soon as I saw how much memory I had left after my little test program.
I just can't seem to win.
Anyway, thanks..
Chad
That's how I set it up.
Thanks for double checking my settings.
On the bigger chip. I realized that as soon as I saw how much memory I had left after my little test program.
I just can't seem to win.
Anyway, thanks..
Chad
Last edited by chad on Mon Oct 19, 2020 4:52 pm, edited 1 time in total.
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Hi Guys,
I do not have such an device however
In my opinion it should work as follow
You need to set the frequency of the Internal OSC use the OSC helper the setting of the PLL 3 or 4 times depend on the setting of the OSCCon register if 16MHz is used the you can only set the PLL to 3 which expects and input Frq of 48Mhz then
If you do not set the OSCCON register the internal OSC is running at it default which I expect is 4Mhz
I do not have such an device however
In my opinion it should work as follow
You need to set the frequency of the Internal OSC use the OSC helper the setting of the PLL 3 or 4 times depend on the setting of the OSCCon register if 16MHz is used the you can only set the PLL to 3 which expects and input Frq of 48Mhz then
If you do not set the OSCCON register the internal OSC is running at it default which I expect is 4Mhz
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
There is no OscHelper setting that matches. I have to disable the C-code to get it to compile.
Like I said it sort-of runs. It takes 5 seconds to update my little oled display. It then hangs a after a little bit.
I am totally willing to accept that I have something set wrong. I did infact. This one was my fault.
Chad
*edited , my fault.
Like I said it sort-of runs. It takes 5 seconds to update my little oled display. It then hangs a after a little bit.
I am totally willing to accept that I have something set wrong. I did infact. This one was my fault.
Chad
*edited , my fault.
Last edited by chad on Mon Oct 19, 2020 4:21 pm, edited 1 time in total.
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Hi Chad
The OSChelper gives all the possible Frequencies for the internal OSC
if you select 16Mhz then
the Internal OSC is running at 16Mhz which is the input frequency to the MUX unit then by setting the PLL bit to 3 times is 3 x16 = 48Mhz Clock frequency as you will see in the above post OSC block diagram
I hope this is more clear
The OSChelper gives all the possible Frequencies for the internal OSC
if you select 16Mhz then
the Internal OSC is running at 16Mhz which is the input frequency to the MUX unit then by setting the PLL bit to 3 times is 3 x16 = 48Mhz Clock frequency as you will see in the above post OSC block diagram
I hope this is more clear
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
This is what I get if I set 16mhz:
18f test 1.c: main()
4195: OSCFRQ = 0x08;
^ (192) undefined identifier "OSCFRQ"
(908) exit status = 1
(908) exit status = 1
Error returned from [xc8.exe]
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1
Autoclose turned off
FINISHED
?
18f test 1.c: main()
4195: OSCFRQ = 0x08;
^ (192) undefined identifier "OSCFRQ"
(908) exit status = 1
(908) exit status = 1
Error returned from [xc8.exe]
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1
Autoclose turned off
FINISHED
?
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
With me these settings compile just fine
?
can you upload your FC files and I will try to compile it !
?
can you upload your FC files and I will try to compile it !
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
The error is because OSCFRQ within C code is not used on your current target device to set internal osc speed.
OSCCON is used instead.
For future reference, just use search (magnifying glass icon) and enter intosc, this is what QMESAR was referring to
That will bring the IntOscHelper up, so add it to 2D or 3D panel
IntOscHelper is used via it's properties to show the correct register name and value to give the required speed.
For example if using 16 MHz internal osc then x 3 pll = 48MHz, then set the IntOscHelper for 16MHz.
That will give you: Ignore that warning, as you have set target clock within project options to 48000000
You can copy and paste required value within a C code block.
In this case with
Code: Select all
OSCCON = 0x70;
But sounds logical to me.
Martin
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Ok So that was a big help. OSCCON and not OSCFREQ helped. That did make it faster. The chip runs for a bit then hangs and resets but that is at least progress. I don't know where I got the oscfreq instead. I adapted my test program from another chip that was already wired up with some pin changes.
Thank you for the help. It is a step forward.
Chad
Here is my little test program. It's basically just a test of a handful of components.
Thank you for the help. It is a step forward.
Chad
Here is my little test program. It's basically just a test of a handful of components.
- Attachments
-
- 18f test 1.fcfx
- (24.57 KiB) Downloaded 151 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
That usually happens when Watchdog Timer Enable bits is set to enable (within Configuration settings) when you don't clear the watchdog timer with
Code: Select all
MX_CLEAR_WATCHDOG;
My advice would be to set Watchdog Timer Enable bits to Disabled Within Hardware
Martin
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Duplicated advise
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Ok Martin
I leave this post now ,Sorry I posted just after you posted did not see your response
I leave this post now ,Sorry I posted just after you posted did not see your response
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems.
Little update.
I was sending data to a UART. I disabled the enable but didn't disable the sending. That was hanging the chip. I also disabled the WDT, hopefully that will fix the chip resetting.
Thank you guys for helping, It is appreciated.
Chad
I was sending data to a UART. I disabled the enable but didn't disable the sending. That was hanging the chip. I also disabled the WDT, hopefully that will fix the chip resetting.
Thank you guys for helping, It is appreciated.
Chad
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems. Resolved use OSCCON and not OSCFREQ.
Hi QMESAR,
Far better to get a reply from multiple people rather than from no one.
My apologises for jumping in.
I should have waited longer before replying.
Hi chad,
My fingers are crossed for you.
Lets hope target device works well.
I always start any new devices with a one second flasher test.
Although if using a scope or logic analyser I set the delay for 10ms.
Makes no difference on the time delay, so long as its not in microseconds & the on/off time duration match.
All posts are useful, even if duplicated.
Far better to get a reply from multiple people rather than from no one.
My apologises for jumping in.
I should have waited longer before replying.
Hi chad,
My fingers are crossed for you.
Lets hope target device works well.
I always start any new devices with a one second flasher test.
Although if using a scope or logic analyser I set the delay for 10ms.
Makes no difference on the time delay, so long as its not in microseconds & the on/off time duration match.
Martin
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Bringing up a new chip 18f24k50 Having some problems. Resolved use OSCCON and not OSCFREQ.
Hi Martin
No issues ,I just did not see you already replied and that was the meaning not to double post the same things ,
I apologize if you feel I did not like that you posted That was really not the intention .
Chad as Martin I really hope you get things going all fingers crossed ,
No issues ,I just did not see you already replied and that was the meaning not to double post the same things ,
I apologize if you feel I did not like that you posted That was really not the intention .
Chad as Martin I really hope you get things going all fingers crossed ,
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR