Hi!
Is it possible/probable that the config file for the 16F15224 has errors? I did not succeed in activating the RSTOSC_LFINTOSC.
Far more serious is that with these settings "#config MCLRE_INTMCLR, WDTE_OFF, WDTE_SWDTEN, BOREN_OFF, RSTOSC_HFINTOSC_1MHZ, FEXTOSC_OFF" only some of the controllers start properly, most of them do not work after powering on again. If I reduce the settings to "#config MCLRE_INTMCLR, RSTOSC_HFINTOSC_1MHZ", it seems to work...
Can someone explain me the structure of the "16f15224.dat" file? I am irritated that according to my understanding e.g. the address ",2,16383" is accessed several times? Shouldn't these be different addresses or do I understand something wrong?
You are understanding the chip datafile incorrectly. For example "2, 16383"
The "2" represents Config Word 2 at address 0x8008 ( see datasheet for addresses)
16383 is the bit mask ( Not an address) for the bits in ConfigWord2. There are 14 bits in a 16F Config Word, therefore when all are 1's the dec val is 16383
Decimal 16383 = 111111 11111111 Binary where a specific function is enabled with a "0"
and disabled with a "1".
So for example STVREN_ON,2,16383 means that this function is at address 0x8008 and since the bit is a 1 ( all bits are 1 at reset) ... STRVEN_ON is disabled.
It seems to me that when you change MCLRE from External to Internal and they all start working, that it is likely that the MCLRE Pin may be missing a pull up resistor. This is Pin 4 on the 16F15224.
Anytime that MCLRE = ON/External or LVP = ON there must be a pullup resistor on the MCLRE Pin
As far as operation at 31K (LFINTOSC) I do not think that this is supported on this series of chip (Yet?)
See attachment from PicInfo tool. This shows a min of 1 Mhz.
Hi William,
thank you very much for your explanation!
Can you please explain where I can see that the CONFIG2 address is 0x8008? I can't find this address neither in the DAT file nor in the XML file...
As far as operation at 31K (LFINTOSC) I do not think that this is supported on this series of chip (Yet?)
The datasheet says:
Clocking Structure
• High-Precision Internal Oscillator Block (HFINTOSC):
– Selectable frequencies up to 32 MHz
– ±2% at calibration • Internal 31 kHz Oscillator (LFINTOSC)
• External High-Frequency Clock Input:
– Two External Clock (EC) Power modes
So actually it should be possible...
It seems to me that when you change MCLRE from External to Internal and they all start working, that it is likely that the MCLRE Pin may be missing a pull up resistor. This is Pin 4 on the 16F15224.
Anytime that MCLRE = ON/External or LVP = ON there must be a pullup resistor on the MCLRE Pin
I tried a resistor on MCLRE with no success!
With "#config MCLRE_INTMCLR, RSTOSC_HFINTOSC_1MHZ" the circuit now works correctly (with no resistor) - but I do not know why!?!
I had used the PIC16F15323 before - but unfortunately it is not available at the moment! :-(
Frank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
31K support - I have just added. Get DEV build 1203 is that the corrected DAT files for the 16F152xx chip family. To get the DEV build start GC Studio, change the Channel to DEV. Or, I have attached the one DAT you need to this post - put in your CHIPDATA folder.
I have posted a new DAT at 09:38 London Time 9/12/2022
The address of the configuration data can be found in the Datasheet on Page 22/ 8.1 as well as in in Table 15.1 . NVM Organization and Access Information on page 107.
Remember at 31K system clock, the timing accuracy will not be perfect. There can be no microsecond delays. So use milliseconds instead.
One instruction take ~30 us at a system clock of 32,768 Hz
1,000,000 / 32,768 = 30 us
William
Last edit: William Roth 2022-12-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Attached is a small program to test the operation of the 16F15224. It works ok here on a real chjp.
Make sure you have a 10K resistor from Pin4 to Vdd (5V)
Attached is a small program to test the operation of the 16F15224. It works ok here on a real chjp.
Make sure you have a 10K resistor from Pin4 to Vdd (5V)
William
Hi William,
your program works as it should (with the new DAT file), but also without pullup with a floating MCLR...
Frank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It may seem to work OK without the Pullup. But if you leave it floating the chip can/will intermittently reset.
Don't do it.
Added: There is an internal weak pullup that is enabled when MCLRE = On. This prevents the pin from actually "floating". There is also an internal 'noise filter' so that short pulses are ignored. However, the internal weak pullup may not be sufficient to hold the chip in reset in noisy environments eg, servos, motors , etc. Therefore an external pullup is highly recommended.
Last edit: William Roth 2022-12-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It can be sufficient if no external reset capability is necessary or wanted, especially in low pin count devices where every pin is needed for analog or digital purposes.
However, in many applications, and in the development environment, an external reset switch/circuit may be prudent or even necessary. Otherwise there would no need for MCLRE and it could be eliminated altogether.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I asked the question because I often get problems with low current applications. I have found that setting MCLR as an input and connecting it to ground reduces SLEEP current (even when MCLR=off has been selected). I have also used it as a SDI pin for SPI (when I ran out of other pins). I prefer to use the power down reset rather than MCLR.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
Is it possible/probable that the config file for the 16F15224 has errors? I did not succeed in activating the RSTOSC_LFINTOSC.
Far more serious is that with these settings "#config MCLRE_INTMCLR, WDTE_OFF, WDTE_SWDTEN, BOREN_OFF, RSTOSC_HFINTOSC_1MHZ, FEXTOSC_OFF" only some of the controllers start properly, most of them do not work after powering on again. If I reduce the settings to "#config MCLRE_INTMCLR, RSTOSC_HFINTOSC_1MHZ", it seems to work...
Can someone explain me the structure of the "16f15224.dat" file? I am irritated that according to my understanding e.g. the address ",2,16383" is accessed several times? Shouldn't these be different addresses or do I understand something wrong?
MCLRE_EXTMCLR,2,16383
PWRTS_PWRT_OFF,2,16383
WDTE_ON,2,16383
BOREN_ON,2,16383
BORV_LO,2,16383
PPS1WAY_ON,2,16383
STVREN_ON,2,16383
THANKS!
Frank
Hi Frank,
You are understanding the chip datafile incorrectly. For example "2, 16383"
The "2" represents Config Word 2 at address 0x8008 ( see datasheet for addresses)
16383 is the bit mask ( Not an address) for the bits in ConfigWord2. There are 14 bits in a 16F Config Word, therefore when all are 1's the dec val is 16383
Decimal 16383 = 111111 11111111 Binary where a specific function is enabled with a "0"
and disabled with a "1".
So for example STVREN_ON,2,16383 means that this function is at address 0x8008 and since the bit is a 1 ( all bits are 1 at reset) ... STRVEN_ON is disabled.
It seems to me that when you change MCLRE from External to Internal and they all start working, that it is likely that the MCLRE Pin may be missing a pull up resistor. This is Pin 4 on the 16F15224.
Anytime that MCLRE = ON/External or LVP = ON there must be a pullup resistor on the MCLRE Pin
As far as operation at 31K (LFINTOSC) I do not think that this is supported on this series of chip (Yet?)
See attachment from PicInfo tool. This shows a min of 1 Mhz.
William
Last edit: William Roth 2022-12-08
Hi William,
thank you very much for your explanation!
Can you please explain where I can see that the CONFIG2 address is 0x8008? I can't find this address neither in the DAT file nor in the XML file...
The datasheet says:
So actually it should be possible...
I tried a resistor on MCLRE with no success!
With "#config MCLRE_INTMCLR, RSTOSC_HFINTOSC_1MHZ" the circuit now works correctly (with no resistor) - but I do not know why!?!
I had used the PIC16F15323 before - but unfortunately it is not available at the moment! :-(
Frank
Frank - thanks for reporting. An oversight.
31K support - I have just added. Get DEV build 1203 is that the corrected DAT files for the 16F152xx chip family. To get the DEV build start GC Studio, change the Channel to DEV. Or, I have attached the one DAT you need to this post - put in your CHIPDATA folder.
I have posted a new DAT at 09:38 London Time 9/12/2022
Evan
Last edit: Anobium 2022-12-09
Hi Evan,
thank you very much!!!
Frank
So, do test and let us know of any issues.
The address of the configuration data can be found in the Datasheet on Page 22/ 8.1 as well as in in Table 15.1 . NVM Organization and Access Information on page 107.
Remember at 31K system clock, the timing accuracy will not be perfect. There can be no microsecond delays. So use milliseconds instead.
One instruction take ~30 us at a system clock of 32,768 Hz
1,000,000 / 32,768 = 30 us
William
Last edit: William Roth 2022-12-09
For Frank,
Attached is a small program to test the operation of the 16F15224. It works ok here on a real chjp.
Make sure you have a 10K resistor from Pin4 to Vdd (5V)
William
Last edit: William Roth 2022-12-09
The config statements could be rationalised as the compiler will set these automatically. It is still good to have them for clarity.
The
RSTOSC = LFINTOSC
is extracted from the new DAT file. And,FEXTOSC = OFF
is a generic default.Hi William,
your program works as it should (with the new DAT file), but also without pullup with a floating MCLR...
Frank
@Frank
It may seem to work OK without the Pullup. But if you leave it floating the chip can/will intermittently reset.
Don't do it.
Added: There is an internal weak pullup that is enabled when MCLRE = On. This prevents the pin from actually "floating". There is also an internal 'noise filter' so that short pulses are ignored. However, the internal weak pullup may not be sufficient to hold the chip in reset in noisy environments eg, servos, motors , etc. Therefore an external pullup is highly recommended.
Last edit: William Roth 2022-12-12
With regard to the MCLR pin. Why is not setting MCLR=Off not sufficient?
It can be sufficient if no external reset capability is necessary or wanted, especially in low pin count devices where every pin is needed for analog or digital purposes.
However, in many applications, and in the development environment, an external reset switch/circuit may be prudent or even necessary. Otherwise there would no need for MCLRE and it could be eliminated altogether.
I asked the question because I often get problems with low current applications. I have found that setting MCLR as an input and connecting it to ground reduces SLEEP current (even when MCLR=off has been selected). I have also used it as a SDI pin for SPI (when I ran out of other pins). I prefer to use the power down reset rather than MCLR.