http://sreenu.searchbuk.com/

On Monday, April 11, 2016 at 7:50:51 PM UTC+5:30, Bryan Wilcutt wrote:
>
> I've been running tests on a BBB using a Novatel USB760 cellular modem.  
> The test I am running is rather simple-- just pinging the modem for it's 
> RSSI settings so that I can modify some BB led's to show reception levels 
> [4 'bars'].
>
> After some time the modem freezes and stops communicating.  Breaking the 
> script and restarting doesn't help-- all communication to the USB stick is 
> dead and a reboot is required.  I'm doubtful it is the USB stick itself 
> since there's been a lot of internet chatter of issues with the USB drivers 
> on Linux [but I could be wrong].
>
> My boot command line:
>
> cmdline=console=ttyO0,115200n8 root=/dev/mmcblk0p1 quiet loglevel=3 
> usbcore.autosuspend=-1
>
> I am using:
>
> 4.1.15-ti-rt-r48
>
> I added "autosuspend" as a suggestion from another site [and have yet to 
> test it].
>
> The last test I ran [without autosuspend] got me to 15,577 seconds (4 
> hours) and an iteration count of 70,741.  At that point, a lock up 
> occurred.  lsusb still showed the USB stick was present.
>
> Anyone have any suggestions?
>
> Here's my script:
>
>
> #!/bin/bash
> leddir="/sys/class/gpio"
> cmdport="/dev/ttyUSB0"
>
> # Specify which GPIOs belong to which LEDs.
> led_1_gpio=46
> led_2_gpio=27
> led_3_gpio=65
> led_4_gpio=22
>
> # Locale of GPIO pins in fsys
>
> led_1_bar="$leddir/gpio$led_1_gpio"
> led_2_bar="$leddir/gpio$led_2_gpio"
> led_3_bar="$leddir/gpio$led_3_gpio"
> led_4_bar="$leddir/gpio$led_4_gpio"
>
> function traperr {
>         while read -t 0 var < $cmdport; do continue; done
>         echo "err"
> }
> trap traperr ERR
>
> function setup_gpios {
>         # If GPIOs are not already exported, export them here.
>         # Set their directions to output.
>         if [ ! -e $led_1_bar ]; then
>                 echo $led_1_gpio > $leddir/export
>                 echo out > $led_1_bar/direction
>         fi
>         if [ ! -e $led_2_bar ]; then
>                 echo $led_2_gpio > $leddir/export
>                 echo out > $led_2_bar/direction
>         fi
>         if [ ! -e $led_3_bar ]; then
>                 echo $led_3_gpio > $leddir/export
>                 echo out > $led_3_bar/direction
>         fi
>         if [ ! -e $led_4_bar ]; then
>                 echo $led_4_gpio > $leddir/export
>                 echo out > $led_4_bar/direction
>         fi
> }
>
> function flush_modem {
>         echo "Flushing buffers..."
>         input="$cmdport"
>         echo -e -n "\r"
>         while read -t 0 var < $cmdport; do continue; done
> }
>
> function get_attention {
>         input="$cmdport"
>         echo "Detecting modem..."
>
>         # Get modem attention
>
>         echo -e -n "\n\n"
>         tries=1
>
>         until [[ "$line" == "OK" && "$tries" -lt 10 ]]
>         do
>                 echo -e -n "Try #$tries\r"
>                 echo -e -n "\nAT\n" > $cmdport
>                 read -r -t 2 line
>                 tries=$((tries+1))
>         done < "$input"
>
>         echo -e "\n"
>         if [ "$tries" -eq 10 ]; then
>             echo "Could not establish communication to modem, giving up."
>             exit 1
>         fi
> }
>
> function query_modem {
>         input="$cmdport"
>
>         # Communicate to the USB Wireless adaptor modem.
>         # Query for RSSI - Receive Signal Strength Indicator
>
>         echo -e -n "\nAT\$NWRSSI\n" > $cmdport
>
>         # Command USB for RSSI info
>
>         while read -r -t 2 line; do
>                 if [[ -z $line ]]; then
>                         continue;
>                elif [[ "$line" == "OK" ]]; then
>                         break;
>                 else
>                         rssi=${line#*=}
>                         echo "$counter>$rssi"
>                         counter=$((counter+1))
>
>                         # Change LEDS - Only channel 1 is used on Onyxx
>                         # 110+     : No leds (bad quality)
>                         # 94 - 109 : 1 led (marginal)
>                         # 85 - 93  : 2 leds (okay)
>                         # 75 - 84  : 3 leds (good)
>                         # 0 - 74   : 4 leds (excellent)
>
>                         rssi=$(echo $rssi | tr -d 
> "[:alpha:][:blank:][:space:][:punct:]")
>
>                         if [[ $rssi -ge 110 ]]; then
>                                 echo 0 > $led_1_bar/value
>                                 echo 0 > $led_2_bar/value
>                                 echo 0 > $led_3_bar/value
>                                 echo 0 > $led_4_bar/value
>                         elif [[ $rssi -ge 94 ]]; then
>                                 echo 0 > $led_1_bar/value
>                                 echo 0 > $led_2_bar/value
>                                 echo 0 > $led_3_bar/value
>                                 echo 1 > $led_4_bar/value
>                         elif [[ $rssi -ge 85 ]]; then
>                                 echo 0 > $led_1_bar/value
>                                 echo 0 > $led_2_bar/value
>                                 echo 1 > $led_3_bar/value
>                                 echo 1 > $led_4_bar/value
>                         elif [[ $rssi -ge 75 ]]; then
>                                 echo 0 > $led_1_bar/value
>                                 echo 1 > $led_2_bar/value
>                                 echo 1 > $led_3_bar/value
>                                 echo 1 > $led_4_bar/value
>                         elif [[ $rssi -gt 0 ]]; then
>                                 echo 1 > $led_1_bar/value
>                                 echo 1 > $led_2_bar/value
>                                 echo 1 > $led_3_bar/value
>                                 echo 1 > $led_4_bar/value
>                         fi;
>                 fi;
>         done < "$input"
> }
>
> # The program main()
>
> echo "USB760 RSSI Bar Application"
> setup_gpios
> flush_modem
> get_attention
>
> counter=1
> while true; do
>     sleep 0.1          # Allow USB to catch it's breath
>     query_modem
> done
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/ed516730-bfb1-41b5-866e-07be7a97848e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to