Love UECIDE? Why not consider supporting the development?

working code no longer working

Re: working code no longer working

Postby GastonLagaffe » Mon Mar 20, 2017 12:22 pm

Salut Matt,
I looked at the map files of the good and bad side:
On the bad side I find:
Code: Select all
Allocating common symbols
Common symbol       size              file

_analogRead_channelNumber
                    0x1               c:\UECIDE\cache\chipkit\boxtec-helvepic32\libCore_api.a(wiring_analog.c.o)
__PIC32_pbClk       0x4               c:\UECIDE\cache\chipkit\boxtec-helvepic32\libCore_api.a(wiring.c.o)

on the good side I only see:
Code: Select all
Allocating common symbols
Common symbol       size              file

__PIC32_pbClk       0x4               C:\Users\Mathias\AppData\Local\UECIDE\cache\chipkit\boxtec-helvepic32\libCore_api.a(wiring.c.o)


So I commented out the line
Code: Select all
  randomSeed(analogRead(0));

in setup() and the code works! It is reproducible: if I un-comment the analogRead(0), the program hangs, commented out and the program runs.
Perhaps that give a hint ... The analogRead is not essential to the graphical demo code but if there is an issue with this basic routine, I may not be the only one facing trouble

Ciao, Mathias
GastonLagaffe
 
Posts: 57
Joined: Thu May 15, 2014 4:22 pm
Location: Germany
I use UECIDE on: Windows
 

Re: working code no longer working

Postby GastonLagaffe » Mon Mar 20, 2017 2:34 pm

Quick update:
I changed the analogRead from pin 0 to pin 4 (using RB0 instead of RB5). It now runs on all PCs ...

Ciao, Mathias
GastonLagaffe
 
Posts: 57
Joined: Thu May 15, 2014 4:22 pm
Location: Germany
I use UECIDE on: Windows
 

Re: working code no longer working

Postby matt » Mon Mar 20, 2017 2:59 pm

This is truly odd. It certainly looks like something bad happening during linking, but quite what I really don't know.
Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".
matt
Site Admin
 
Posts: 1286
Joined: Sun Jul 07, 2013 11:37 am
I use UECIDE on: Linux
 

Re: working code no longer working

Postby GastonLagaffe » Wed Mar 22, 2017 4:00 pm

Salut Matt,

I can reproduce this problem in a small environment: Attempting to execute a analogRead on a non-analog pin will hang the program. I used this simple code to verify:
Code: Select all
int user_led = 10;
int analog_pin = 11;
void setup()
{
  pinMode(user_led,OUTPUT);
  pinMode(analog_pin,INPUT);
  analogRead(analog_pin);
}

void loop()
{
   digitalWrite(user_led, HIGH);
   delay(250);
   digitalWrite(user_led, LOW);
   delay(250);
}

As long as the analog_pin is a ADC pin of the chip, the led blinks, if not, the led goes HIGH and the program hangs.

Ciao, Mathias
GastonLagaffe
 
Posts: 57
Joined: Thu May 15, 2014 4:22 pm
Location: Germany
I use UECIDE on: Windows
 

Re: working code no longer working

Postby matt » Wed Mar 22, 2017 4:55 pm

Interesting. I have just replicated it with the Lenny, but it's fine on the Uno32 and uC32. So it may be something only on the MX1/2 chips - maybe PPS related?
Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".
matt
Site Admin
 
Posts: 1286
Joined: Sun Jul 07, 2013 11:37 am
I use UECIDE on: Linux
 
 
Previous

Return to PIC32

Who is online

Users browsing this forum: No registered users and 1 guest

cron