Teensuino strang behaviour

Status
Not open for further replies.

ossi

Well-known member
The following program (Teensy36) :
Code:
void setup() {
  Serial.begin(115200);  
  for(int k=0 ; k<6 ; k++){
    delay(50);
    delay(100); 
    }
  test1() ;
  }

double iirdX1[20] ;

void test1(){
  float inp[16384] ;
  double inpd[16384] ;
  float CMSISoutp[16384] ;
  float CMPoutp[16384] ;
 
  int nSteps=1024 ;
  double iirdX0=inpd[1] ;
  iirdX1[1]=iirdX0 ;
  for(int k=0 ; k<nSteps ; k++){
     Serial.printf("k=%3d input=%18.10f out=%18.10f =?= %18.10f\n",k,inp[k],CMSISoutp[k],CMPoutp[k]) ;  
    }
  }

void loop() {
  }
gives an erratic behaviour. The download restarts again and again without stopping, USB seem to restart every time (I hear a beep from the uSB).

If you make minor changes to the program this erratic behaviour will probably disappear. The program is the minimum program that shows for me the behaviour. The program seems to compile fine. Has someone else seen a endless download-loop ? Could someone test whether he can download the code?
 
You don't have enough memory for all of those variables you put on the stack when you call test1...

64K - float inp[16384] ;
128K - double inpd[16384] ;
64K - float CMSISoutp[16384] ;
64K - float CMPoutp[16384] ;

> 256KB of RAM...
 
@KurtE
Seems that was the error. Thanks a lot.
Normally I put those arrays in the static section so that I get an error from the compiler if I use more than 256k. But this time I put in onto the stack and did not check my memory sizes.
Nevertheless it had not expected that the USB restarting would happen with such an errror.
 
Status
Not open for further replies.
Back
Top