PIC16FL1939 Freezes with ADC component.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

PIC16FL1939 Freezes with ADC component.

Post by medelec35 »

I believe this is also related to 16F1824 and 16F1827 that kept resetting when using ADC.
Attached is Flowchart (Thanks John Crow and Dan for RTC routines) to emulate (all except mtouch as that's not completed yet) the preloaded software on the Microchip One PIC Microcontroller Platform Demo board,

If ADC component is disabled (link pin 3 and 4 of ISSP ), then 16FL1939 runs indefinitely. Display keeps showing correct time from RTC
As soon as ADC component is re-enabled, RTC only Runs for a shot period of time then 16FL1939 freezes.

The only clue I have noticed is lowest ADC value shows as 30 when it should be 0

I have loaded the attached pic version and converted it for PIC24FJ256GA106 and loaded it into demo board.
Although there are other issues (I will post issues in VC section) , with ADC enabled PIC24FJ256GA106 runs without freezing at all.

If this gets solved ,it will be great since I could go back to 16F1827 with the fix :)

Martin
Attachments
Demo_Board1_8bit.fcf
(41.46 KiB) Downloaded 260 times
Martin

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: PIC16FL1939 Freezes with ADC component.

Post by Benj »

Hi Martin,

Hm this is a wierd one. I have replicated your issue and the min ADC reading for me is 32. I am also getting the random crashes while the program is running.

I did change the acq time in the ADC properties page to 200 and this seemed to help the crashing issue. Also setting the Conv speed to /8 seemed to help but still not getting the full voltage range?

medelec35
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: PIC16FL1939 Freezes with ADC component.

Post by medelec35 »

Hi Ben,
With 16F1xxx series i was experiencing resetting rather than crashes.
I can't help thinking its all related?
Could ADC component be accessing a wrong address?
It works as expected with original demo software at 32 MHz
Would you be able to tell from original assembly listing how ADC part workks as it appeasrs to be different to the standard ADC within 16F88 etc
Martin

medelec35
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: PIC16FL1939 Freezes with ADC component.

Post by medelec35 »

Here is an odd thing that I can't explain.

I have created a c component for ADC.
Using that ADC ranges from 0 to 1023.
However demo board still crashes.

If I copy and paste c code for ADC into demo board flowchart that ws posted in a different supply then instead of 0 it stars at 30.

Is there something conflicting with variables associated with ADC?

I have reduced osc speed to 8MHz just in case faster internal osc speed was causing an issue
Attachments
One pic ADC test1 FC5.fcf
same C code but 0 to 1023
(10 KiB) Downloaded 267 times
Demo_Board2_Test_8bit.fcf
ADC 30 to 1023
(42.96 KiB) Downloaded 260 times
Martin

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: PIC16FL1939 Freezes with ADC component.

Post by Benj »

Hi Martin,

I have just spent about an hour playing around with the board, the device datasheet and the ADC CAL and can't make head nor tail as to why the program is hanging. Still hanging for me and not resetting. Also my base ADC value is 32 so looks like there may be some kind of tolerance issue.

Could it possible be linked to the AAA battery. Have you tried powering using the PICkit whilst using sampling the analogue? I powered the board via the terminals on an EB064 the program now seems to run ok but the ADC reading is still stuck at a minimum of 32.

Could also have something to do with the cap touch pins? Maybe stray voltage getting onto the ADC cap. Might be worth outputting 0 to all the cap touch pins on startup to see if this helps at all.

Edit - program crashed at 00:01:24, Might be being cynical but maybe this is one reason why the board was so cheap :)

medelec35
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: PIC16FL1939 Freezes with ADC component.

Post by medelec35 »

Thanks for looking into this.

16F1xxx series would be great devices, if they weren’t so problematic. As yo know also has issues with 16F1824 and 16F1827.
Problems are not going to disappear with 16LF1839.
Benj wrote:Might be being synical but maybe this is one reason why the board was so cheap :) Could also have something to do with the cap touch pins? Maybe stray voltage getting onto the ADC cap. Might be worth outputting 0 to all the cap touch pins on startup to see if this helps at all.
I don’t think so, otherwise the same issue of 30 to 1023 would be present with microchip preloaded software and my One pic ADC test1 FC5.fcf
With One pic ADC test1 FC5.fcf that dispalys 0 to 1023 but still freezes. I placed wrong number in file comments. Should have been 0 to 1023 not 30 to 1023.
Just changed it.

I would love to do how microchip developed code so adc runs from 0 to 1023 and do not freeze.
Do any one at MM have a contact at microchip they can ask please?
Martin

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: PIC16FL1939 Freezes with ADC component.

Post by Benj »

Hi Martin,

I will ask around and see if I can get through to anyone in the know. Great news on getting the full range. I will have a look at what you did and see if I can replicate here.

medelec35
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: PIC16FL1939 Freezes with ADC component.

Post by medelec35 »

Thanks Ben,
But as stated in a previous post, although range is 0 to 1023
1) It still freezes chip.
2) Same code inserted into demo flowchart that displays RTC still causes range to vary between 30 and 1023.
The code preloaded when board is 1st purchased has none of the issues, so I’m wondering is it a variable or address conflict between Flowcode and newer 16F1xxx devices?
Have you saved a copy of original preloaded code?
If not I have got hex file I can post.

It would be great if this mystery could be solved, but I believe this is beyond my capabilities. :(
Martin

Post Reply