home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   RBERRYPI      Support for the Raspberry Pi device      21,939 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,739 of 21,939   
   The Natural Philosopher to All   
   Need help with PI PICO...   
   23 Mar 24 17:45:05   
   
   INTL 3:770/1 3:770/3   
   REPLYADDR tnp@invalid.invalid   
   REPLYTO 3:770/3.0 UUCP   
   MSGID:  ca8aa255   
   PID: SoupGate-Win32 v1.05   
   Ok, this is the one destined to be an oil level sensor and I have been   
   working on getting a stable TCP/IP and Wi-Fi stack, which seems to have   
   been achieved, as its talking reliably, albeit with delay, to my most   
   remote Wi-Fi AP at a signal level  generally around -87dbM.   
   That is not, however the problem (although I thought it was). The   
   problem seems to be that very very occasionally and as far as I can tell   
   *completely randomly*, it fails to return from the function listed   
   below. Cargo culted from the module manufacturers application notes   
      
   This is for the ultrasonic transducer module.   
   When it fails, all GPIO pins to and from the transducer module measure  LOW.   
      
   static float get_distance()   
   	{   
   	int i;   
   	absolute_time_t start;   
   	absolute_time_t end;   
   	static int64_t us_delay;   
   	gpio_put(ULTRASONIC_OUT,0);   
   	sleep_us(2);   
   	//set output pin high   
   	gpio_put(ULTRASONIC_OUT,1);   
   	sleep_us(10);   
   	gpio_put(ULTRASONIC_OUT,0); //reset the input   
   	// wait for echo pulse start   
   	while(!gpio_get(ULTRASONIC_IN))   
   		;   
   	//read clock and store   
   	start=get_absolute_time ();   
   	//wait for echo pin to go low;   
   	while(gpio_get(ULTRASONIC_IN))   
   		;   
   	end=get_absolute_time ();   
   	//get clock difference   
   	us_delay=absolute_time_diff_us(start,end);   
   	//convert to float and return it as cm   
   	return (((float)(us_delay))*0.034/2);   
   	}   
      
   It would seem from the pin states that it gets permanently stuck in 	   
      
   while(!gpio_get(ULTRASONIC_IN))   
   		;   
      
   Which as understand it is waiting for the module (HCSR04) to *start* to   
   send a pulse.   
      
   Now obviously infinite loops with no termination condition under fault   
   conditions are poor code, but I am leaving it there until I understand   
   why the code is in fact hanging.   
   Someone online suggested that asynchronous interrupts may be the issue,   
   but I cant see why or what interrupts to disable.   
      
   Can anyone cast any light on this one?   
      
   Or suggest a bug hunting methodology?   
      
   --   
   â€śThe fundamental cause of the trouble in the modern world today is that   
   the stupid are cocksure while the intelligent are full of doubt."   
      
       - Bertrand Russell   
      
   --- SoupGate-Win32 v1.05   
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)   
   SEEN-BY: 15/0 19/38 90/1 105/81 106/201 128/260 129/305 135/225 153/757   
   SEEN-BY: 153/7715 218/700 840 220/70 226/17 30 100 227/114 229/110   
   SEEN-BY: 229/111 112 113 200 206 307 317 400 426 428 470 550 616 664   
   SEEN-BY: 229/700 266/512 267/800 282/1038 291/111 292/854 310/31 320/219   
   SEEN-BY: 322/757 342/200 396/45 460/58 633/280 281 412 418 420 509   
   SEEN-BY: 633/2744 712/848 770/1 3 100 330 340 772/210 220 230 5020/400   
   SEEN-BY: 5075/35   
   PATH: 770/3 1 633/280 229/426   
      

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca