Hello,
it is not possible for me to run the PIC 16F1825 with INTOSC 32Mhz. I tried everything, OSCCON=0x70; PLL turned on in the chip options, OSCCON = 0xF0; PLL turned off in the chip options. Here is a small test program. Clock Out is on and gives a speed of 8 Mhz, but the chip always works with 500 Khz. So I suspect an error in the configuration of the multiplexer of the oscillator. I tried it with V8, V9 and V10. I can't get it to work. What am I doing wrong?
Thanks
Dirk
PIC16F1825 Bug in OSCCON
-
- Posts: 85
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 3:55 pm
- Has thanked: 1 time
- Been thanked: 4 times
-
- Valued Contributor
- Posts: 1630
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 761 times
Re: PIC16F1825 Bug in OSCCON
What do you mean by only works at 500kHz? - A PIC running at 32MHz has an instruction rate of 8MHz - so 16 instructions per loop / output to pins and change the value of clk.
It's probably about right?
The 'fastest' I can get on a 32MHz PIC by toggling a pin (A0) is 1.14MHz (with 540ns / 340ns high / low pulses) - you can get faster using PWM if you need?
AVR chips are quicker at 1clk per instruction - so 16MHz chip gives 16MHz instructions.
Note - I cheat and use an output to A0 to set it as an output (rather than fiddling with TRISA etc).
(Sorry - had to change the chip)
Martin
It's probably about right?
The 'fastest' I can get on a 32MHz PIC by toggling a pin (A0) is 1.14MHz (with 540ns / 340ns high / low pulses) - you can get faster using PWM if you need?
AVR chips are quicker at 1clk per instruction - so 16MHz chip gives 16MHz instructions.
Note - I cheat and use an output to A0 to set it as an output (rather than fiddling with TRISA etc).
(Sorry - had to change the chip)
Martin
Re: PIC16F1825 Bug in OSCCON
I mean that the PIC has a default setting of 500 Khz. The switching of pin A0 is only an example. The program runs only with 500 Khz. An older slower chip with 20 Mhz crystal runs more than 20 times faster. I have a program with an 8 bit sinus lut, which can create about 15 Khz at 32 Mhz. With this chip you can't even do 10 Hz.
Dirk
Dirk
-
- Matrix Staff
- Posts: 2086
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 644 times
- Been thanked: 702 times
Re: PIC16F1825 Bug in OSCCON
Hello.
You have got the watchdog timer enabled within your configuration settings
However, you are not cleating the watchdog timer.
The reason for lack of speed when toggling a pin is because your target device constantly resetting.
Try disabling the watchdog timer then see what speed you get.
You have got the watchdog timer enabled within your configuration settings
However, you are not cleating the watchdog timer.
The reason for lack of speed when toggling a pin is because your target device constantly resetting.
Try disabling the watchdog timer then see what speed you get.
Martin
Re: PIC16F1825 Bug in OSCCON
Hello Martin,
I have now disabled everything except Clock Output, same result, see attachment.
It concerns all chips which I use. The PIC16F1825 with 32 Mhz Clock Out 32Mhz (Clock) / 4 (Instructions)
results in 8 Mhz. Main Loop (program) 500Khz. The PIC16F1455 can be operated with 48 Mhz. Clock Out
48Mhz (Clock) / 4 (Instructions) results in 12 Mhz. Main Loop (Program) 500Khz.
I already thought about if there is always a reset. Then the chip is set to 500Khz by default. But everything
is switched off in the configuration. I have no idea. There must be a bug in the configuration.
Dirk
I have now disabled everything except Clock Output, same result, see attachment.
It concerns all chips which I use. The PIC16F1825 with 32 Mhz Clock Out 32Mhz (Clock) / 4 (Instructions)
results in 8 Mhz. Main Loop (program) 500Khz. The PIC16F1455 can be operated with 48 Mhz. Clock Out
48Mhz (Clock) / 4 (Instructions) results in 12 Mhz. Main Loop (Program) 500Khz.
I already thought about if there is always a reset. Then the chip is set to 500Khz by default. But everything
is switched off in the configuration. I have no idea. There must be a bug in the configuration.
Dirk
- Attachments
-
- SpeedCheck2.fcfx
- (11.01 KiB) Downloaded 766 times
-
- Matrix Staff
- Posts: 2086
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 644 times
- Been thanked: 702 times
Re: PIC16F1825 Bug in OSCCON
Have you tried the one sec flash test to check if your hardware is running at the correct speed?
I have just tried your configuration settings with Martins method of toggling the A0 pin on a 16F1825 and: Using your flowchart with the same configuration, the toggle speed is: All the overheads slow things down and that is what you are seeing.
The 1sec flash test working as expected, so no configuration issues.
As it is not a bug, I have moved the topic to a more appropriate section.
I have just tried your configuration settings with Martins method of toggling the A0 pin on a 16F1825 and: Using your flowchart with the same configuration, the toggle speed is: All the overheads slow things down and that is what you are seeing.
The 1sec flash test working as expected, so no configuration issues.
As it is not a bug, I have moved the topic to a more appropriate section.
Martin
Re: PIC16F1825 Bug in OSCCON
Hello Martin,
It must be a bug. It cannot be that with a clock frequency of 8 Mhz with the program with PWM an output frequency of 10 Khz results. With the second flash the process can always rest 1 second. This is not meaningful. I need continuous calculations which are not possible. Please check the signals with proper hardware frequency counters or oscilloscope. Also when I implement midi and there comes a midi sequence with 3 or more commands, there are errors because the program is too slow. A 16F688 with 20 Mhz crystal program written in assembler is able to reach a 4 Mhz signal. Also if I implement midi and there comes a midi sequence with 3 or more commands, there are errors because the program is too slow.Please check the signals with proper hardware frequency counters or oscilloscope. A 16F688 with 20 Mhz crystal program written in assembler is able to reach a 4 Mhz signal.
The slow speed is now clear to me. See this post.
https://flowcode.co.uk/forums/viewtopic.php?f=5&t=2010
Please check the matter.
Thanks
Dirk
It must be a bug. It cannot be that with a clock frequency of 8 Mhz with the program with PWM an output frequency of 10 Khz results. With the second flash the process can always rest 1 second. This is not meaningful. I need continuous calculations which are not possible. Please check the signals with proper hardware frequency counters or oscilloscope. Also when I implement midi and there comes a midi sequence with 3 or more commands, there are errors because the program is too slow. A 16F688 with 20 Mhz crystal program written in assembler is able to reach a 4 Mhz signal. Also if I implement midi and there comes a midi sequence with 3 or more commands, there are errors because the program is too slow.Please check the signals with proper hardware frequency counters or oscilloscope. A 16F688 with 20 Mhz crystal program written in assembler is able to reach a 4 Mhz signal.
The slow speed is now clear to me. See this post.
https://flowcode.co.uk/forums/viewtopic.php?f=5&t=2010
Please check the matter.
Thanks
Dirk