the SPI lines are now confirmed to be in working order. Most things were fixed by sleeping after sending and by sampling at trailing clock.
About ANY function I put in the looper does not give my feedback to android. Say I feed MOSI back to MISO, I KNOW there is a signal but any attempt to view the MISO input isn't working. Even tried making a seperate infograb function in another class so I can send the data to be viewed in Logcat but that also gives nothing. No data wants to leave looper for some reason. On Thursday, June 5, 2014 5:39:10 PM UTC+2, Ytai wrote: > > Nothing obviously wrong with your code. > Since (if I understand correctly) your FPGA is also under development, > your best way to proceed is to capture the SPI lines with a logic analyzer > and see whether the IOIO is sending valid data. > Also, why doesn't Log.d work in your looper? It normally does. > > > On Thu, Jun 5, 2014 at 3:03 AM, Sidharta Prahladsingh <[email protected] > <javascript:>> wrote: > >> oh also spi is fixed. "spi_ = ioio_.openSpiMaster(new DigitalInput.Spec(4, >> Mode.PULL_UP), new DigitalOutput.Spec(5), >> new DigitalOutput.Spec(3), >> new DigitalOutput.Spec[] { new DigitalOutput.Spec(2) }, >> new SpiMaster.Config(Rate.RATE_1M, false, true));" worked better >> than >> "spi_ = ioio_.openSpiMaster(4, 5, 3, 2, SpiMaster.Rate.RATE_1M);" in our >> situation. >> The latter produced double information. >> >> On Thursday, June 5, 2014 11:51:04 AM UTC+2, Sidharta Prahladsingh wrote: >> >>> Since it would be too much code to go through, I will just at my >>> imports, MainActivity with global variables and the Looper class: >>> Global variables and imports: >>> >>> import java.io.BufferedInputStream; >>> >>> import java.io.File; >>> >>> import java.io.FileOutputStream; >>> >>> import java.io.IOException; >>> >>> import java.io.InputStream; >>> >>> import java.io.InputStreamReader; >>> >>> import java.net.MalformedURLException; >>> >>> import java.net.URL; >>> >>> import java.net.URLConnection; >>> >>> import java.nio.ByteBuffer; >>> >>> import java.util.ArrayList; >>> >>> import java.util.Arrays; >>> >>> import java.util.List; >>> >>> import java.util.concurrent.ExecutionException; >>> >>> >>> import android.R.style; >>> >>> import android.graphics.Bitmap; >>> >>> import android.graphics.Bitmap.Config; >>> >>> import android.graphics.BitmapFactory; >>> >>> import android.graphics.Canvas; >>> >>> import android.graphics.Color; >>> >>> import android.graphics.Matrix; >>> >>> import android.graphics.Paint; >>> >>> import android.graphics.Rect; >>> >>> import android.graphics.Paint.Style; >>> >>> import android.os.AsyncTask; >>> >>> import android.os.Bundle; >>> >>> import android.os.Environment; >>> >>> import android.util.Log; >>> >>> import android.view.Menu; >>> >>> import android.view.MenuInflater; >>> >>> import android.view.MenuItem; >>> >>> import android.view.MotionEvent; >>> >>> import android.view.VelocityTracker; >>> >>> import android.view.View; >>> >>> import android.view.WindowManager; >>> >>> import ioio.lib.api.DigitalInput; >>> >>> import ioio.lib.api.DigitalInput.Spec.Mode; >>> >>> import ioio.lib.api.DigitalOutput; >>> >>> import ioio.lib.api.IOIO; >>> >>> import ioio.lib.api.SpiMaster; >>> >>> import ioio.lib.api.SpiMaster.Rate; >>> >>> import ioio.lib.api.Uart; >>> >>> import ioio.lib.api.exception.ConnectionLostException; >>> >>> import ioio.lib.util.BaseIOIOLooper; >>> >>> import ioio.lib.util.IOIOLooper; >>> >>> import ioio.lib.util.android.IOIOActivity; >>> >>> import android.view.View.OnClickListener; >>> >>> import android.annotation.TargetApi; >>> >>> import android.app.AlarmManager; >>> >>> import android.app.Dialog; >>> >>> import android.app.PendingIntent; >>> >>> import android.content.Context; >>> >>> import android.content.Intent; >>> >>> import android.database.Cursor; >>> >>> import android.net.Uri; >>> >>> import android.os.Build; >>> >>> import android.provider.MediaStore; >>> >>> import android.widget.ArrayAdapter; >>> >>> import android.widget.Button; >>> >>> import android.widget.CheckBox; >>> >>> import android.widget.EditText; >>> >>> import android.widget.FrameLayout; >>> >>> import android.widget.ImageView; >>> >>> import android.widget.LinearLayout; >>> >>> import android.widget.Spinner; >>> >>> import android.widget.TextView; >>> >>> public class MainActivity extends IOIOActivity{ >>> //initiation attributes >>> private EditText custtext; >>> private EditText urltxt; >>> private Button custtxtbut; >>> private Button urlshare; >>> private Button picdisplayButton; >>> private Button rstButton; >>> private ImageView pictest; >>> private static ImageView pictest2; >>> private static ImageView pictest3; >>> private ImageView pictest4; >>> private GifView gifView; >>> private GifDecoder decoder; >>> private VelocityTracker mVelocityTracker = null; >>> private static TextView test; >>> >>> //intiation variables >>> //width and height of the LED-matrix >>> private static int picw =33; >>> private static int pich = 5; >>> private static boolean isgif = false; >>> private boolean bkgchk; >>> private boolean check = true; >>> private int bkgclr = 0; >>> private int txtclr = 3; >>> private static byte[] buffer = new byte[picw*pich*3]; //<---------- >>> This I want to read out in Looper >>> public static List<Bitmap> bmlist = new ArrayList<Bitmap>(); >>> private static Bitmap lastpic = null; >>> private float touchposx; >>> private float touchposy; >>> private float deltax; >>> private float deltay; >>> private Bitmap lastfullbm = null; >>> private Bitmap touchpic =null; >>> private Bitmap oldtouchpic =null; >>> >>> private static byte[] bufferin= new byte[picw*pich*3]; >>> >>> private static boolean picdone = true; >>> >>> >>> *Looper Class:* >>> >>> static class Looper extends BaseIOIOLooper { >>> >>> //initiation of SPI protocol variable >>> >>> private SpiMaster spi_; >>> >>> private DigitalOutput pin8; >>> >>> @Override >>> >>> protected void setup() throws ConnectionLostException { >>> >>> >>> pin8 = ioio_.openDigitalOutput(8, false);//image_enable >>> >>> >>> } >>> >>> @Override >>> >>> public void loop() throws ConnectionLostException, >>> InterruptedException { >>> >>> if (picdone == false) >>> >>> { >>> >>> if (!isgif){ >>> >>> //picture send process >>> >>> spi_ = ioio_.openSpiMaster(new DigitalInput.Spec(4, >>> >>> >>> Mode.PULL_UP), new DigitalOutput.Spec(5), >>> >>> new DigitalOutput.Spec(3), >>> >>> new DigitalOutput.Spec[] { new DigitalOutput.Spec(2) }, >>> >>> new SpiMaster.Config(Rate.RATE_1M, false, true)); >>> >>> byte[] buffer_= buffer; >>> >>> int buffernum = (int) Math.ceil(buffer_.length/48); >>> >>> >>> byte[] buffer1_= new byte[48]; >>> >>> byte[] packetlast= new byte[48]; >>> >>> pin8.write(true); >>> >>> >>> Thread.sleep(500); >>> >>> for (int i =0;i<buffernum;i++){ >>> >>> System.arraycopy(buffer_, i*48, buffer1_, 0, 48); >>> >>> >>> spi_.writeRead( buffer1_, buffer1_.length, >>> >>> >>> buffer1_.length, null,0);* <------- e.g. I want to read here the MISO >>> and display it on the phone or display the buffer array from here to phone. >>> Log.d also doesnt work here but everywhere else.* >>> >>> Thread.sleep(100); >>> >>> >>> } >>> >>> Thread.sleep(500); >>> >>> pin8.write(false); >>> >>> spi_.close(); >>> >>> } >>> >>> >>> else >>> >>> { >>> >>> //GIF send process >>> >>> isgif = false; >>> >>> } >>> >>> picdone =true;//must be true to send 1 image per time. >>> >>> } >>> >>> } >>> >>> >>> >>> >>> } >>> >>> >>> protected IOIOLooper createIOIOLooper() { >>> >>> return new Looper(); >>> >>> } >>> >>> On Wednesday, June 4, 2014 5:55:40 PM UTC+2, Ytai wrote: >>> >>> Regarding SPI: there shouldn't be any lost data. I would try connecting >>> a logic analyzer on MOSI/CLK to verify that. >>> Note that you can do up to 64 bytes on each transaction. >>> To answer the other question I need to look at your code. The static >>> variables should work as you expect, but there's probably something else >>> about your code that you're missing. >>> >>> >>> On Wed, Jun 4, 2014 at 4:33 AM, Sidharta Prahladsingh <sidki...@ >>> >>> ... >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ioio-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/ioio-users. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
