dspic33fj128mc804 and eeprom 25LC256 by SPI - microcontroller

I am trying to write and read from the EEPROM (25LC256) with my dsPIC 33FJ128MC804, I tried to use the examples from the website, however they used the explorer16 with the dsPIC 33FJ256MC710, so I take the code and I made the changes to used it in my dsPIC but I started to use interruptions, right now I can send data, but I am not able to read from the memory, even if I follow the steps in the datasheet of the EEPROM and using the configuration of the SPI.
Could you help me please with this little problem please?
UPDATE: I just noticed that whenever I send the code for read the STATUS register I always get zero as answer, is it normal?
source code: https://www.dropbox.com/s/wdahlmhjrilcqw6/main.c?dl=0

Related

Block for serial output in GNURadio/GRC

I am working on a project that involves GNU Radio/GRC and am not very familiar with the software. I am trying to output data to a serial port in GNU Radio using a block, but have not found a way to do so.
I was wondering if there is a pre-defined block that I can use to put this information to a serial port (USB on a Raspberry Pi 3), or if I had to create my own block. And if I had to create my own block, what that code would look like.
I have been able to write the data to a file using the File Sink to make sure I was getting data, and was wondering if the fix is something as simple as changing the File sink to an serial port sink. See picture below:
http://imgur.com/a/BdaMZ
I also did some research and found a github repo that looks like what I need -- unfortunately, the repository that it links to is no longer there. It did mention using pyserial, which is what I believe is meant for creating my own block in python. The link to this repo is below:
https://github.com/jmalsbury/gr-pyserial
… was wondering if the fix is something as simple as changing the File sink to an serial port sink.
Yes! Or No, it's even easier:
So, in fact, you could even simply use your file sink to write to e.g. /dev/ttyS0 (or /dev/ttyUSB0, or whatever is the device name of your serial port), but you'd have to set up the serial port to work like you want it to separately first. A way of doing that would be using stty, e.g.
stty -F /dev/ttyS0 115200
prior to running your flow graph.
Note that practically all in your flow graph point points to you not being sufficiently proficient with GNU Radio to successfully exchange data. I can't cover everything here, please read the official Guided Tutorials, but:
In a flow graph like yours, where the IO is the inherently rate-limiting element, you must not use "Throttle". Throttle is really just a tool to avoid a flowgraph consuming all your CPU (and to slow down simulations)
Giving your files a .grc ending is bad practice, as that is the ending reserved for GNU Radio flow graphs.
Giving it a .txt ending is plain misleading, since there's no text involved whatsoever. The "file format" (I wouldn't even call it a format) is really just plain binary numbers, as your computer handles them; not decimal ASCII representations of these floating point binary numbers
I also did some research and found a github repo that looks like what I need -- unfortunately, the repository that it links to is no longer there. It did mention using pyserial, which is what I believe is meant for creating my own block in python. The link to this repo is below:
Don't know what you're referring to, https://github.com/jmalsbury/gr-pyserial is perfectly existing!

txt file from pc to arduino

I was not able to find any examples by googling so I thought I might ask help from here.
I have a txt file of n lines. Each line contains a blueprint for arduino uno to execute needed thing, for example flash a light. In my sript I want to "load" this file to UNO and go through this file line by line executing the steps.
I only found examples for this kind of thing for SD card usage.
For example:
https://www.arduino.cc/en/Reference/FileRead
http://forum.arduino.cc/index.php?topic=95303.0
However, I don't have SD card nor can I get one at the moment. Is there a way to read this file directly from pc and save it as an array for UNO to use.
Depending on the operating system you use, you can "pipe" the file to serial port, reading it from the Arduino using Serial object. On Linux:
cat myfile > /dev/ttyUSB0
Replace USB0 if necessary.
EDIT:
For windows you might use type command. Not sure if extended COM ports (other than 1 and 2) will work.
type myfile > COM5
You can try a different approach, that is store the content of required txt file / just the values to the EEPROM of the arduino.
The size of text that can be stored is minimal.The size of EEPROM solely depends on the Arduino used for e.g Mega has 4KB of EEPROM(One of the biggest), UNO has 1KB.This can be extended too as far as I know.
You can look into eeprom examples here -
https://www.arduino.cc/en/Reference/EEPROM
Its very easy to understand, just looks fuzzy and hard in the beginning.
There are other methods like using a SD card as you mentioned since that is not an option EEPROM is next best bet
Hope it helps.

Arduino Ethernet failing to initialize correctly

When the code HERE(Edit: Wrong code :) is used, the Serial monitor is spammed with this:
http://pastebin.com/nsD4CALFg
I cannot find any problems with the code, and it is a long one...
EDIT2: It now spams this http://pastebin.com/BXfFFBKHz
I know what was wrong(Sort of)... There was a bug with that specific program, because I copied the exact same program into an empty one and it worked :L...

PIC Prgramming - The basic flow of things

Can someone please explain to me the basic flow of how this is done.
So currently I a USB pic programmer and also a multi pic adapter. I understand that I can use this to write my program to the PIC. But Im not sure what happens before that, like how do I actually test it with LED or some input sensor etc that gives out analog data?
This is what I have now: http://www.piccircuit.com/shop/pic-programmer/26-ica01-usb-pic-programmer-set.html
So I need to connect this to to a breadboard? And if so how? Im completely lost!! This is the first time that I attempt to do this. What I have done is use my Synapse RF Engine EK2100 to build what I want.
Now what...?
I'm not entirely sure what you're trying to accomplish but what you purchased is a programmer for PIC microcontrollers. After you have written some code whether in assembly or C and compiled it to a hex file, this device will put that code onto a PIC microcontroller that you buy separately. Have you purchased a PIC device to program or do you just have the programmer and the EK2100 kit? If you provide some more detail we can point you in the right direction.
Write a basic 'flash LED' program and then wire-up the PIC to see if it works.
Hot tip - use the internal oscillator to minimise the external component count (makes things simpler). Browse around a PIC savvy site like http://digital-diy.com/ to get lots of interesting ideas and code samples.
The community there mostly use PIC Basic type languages (such as Swordfish) that will land you code that looks something like this (header/setup removed for ease of explanation):
While True
High(LED)
DelaymS(500)
Low(LED)
DelaymS(500)
Wend

BTstack on MSP430F5438A + CC2564 bluetooth module

First, is there any good documentation for the btstack API's. I am trying to learn how to fully use btstack , send and receive data, look for devices within range and initiate connection.I am implementing this for MSP-430F5438A + CC2564 Bluetooth module.
http://code.google.com/p/btstack/wiki/MSP430GettingStarted
This website has some examples, but I am still confused, I need someone to break it down for me.Is there a template that I can start of. Anything would be helpful. If there is a step by step reference on how to connect to a device and exchange packets, it would be really great. Thanks is advance
In the regular "GettingStarted" page is a little explanation on what goes on in the packet handler, which is the main part of where you basically put all of your new code.

Resources