aldo85ita
Posts: 1
Joined: Sun Jun 15, 2014 3:43 pm

SD card corruption after multiple gpio access

Sun Jun 15, 2014 6:32 pm

Goodmorning everybody,
I made a simple application to get GPIOs status (EVERY SECOND) and send them to a remote PC by socket over WiFi.
After one week SD card is currupted.
The function that get GPIO status is the following:

Code: Select all

public static int getGPIOstatus(int gpioNumber){
		/*
		Read value of GPIO 7:
		cat /sys/class/gpio/gpio7/value
		 */
		BufferedReader br = null;
		int ret=0;
		try {
			String sCurrentLine;
			br = new BufferedReader(new FileReader("/sys/class/gpio/gpio"+gpioNumber+"/value"));
			if ((sCurrentLine = br.readLine()) != null) {
				//System.out.println("Current GPIO value is: "+sCurrentLine);
				ret= Integer.parseInt(sCurrentLine);;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (br != null)br.close();
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return ret;
	}
How can this function currupt SD card??? (it should access in read only mode)

Return to “Java”