Arduino code to read and write into a memory using SPI - memory

I'm writing a Arduino code where,
I want to save employee data inside a memory
and retrieve the employee data based on SL No
for communication protocol i'm using SPI
I'm having problem in how to read and write to the memory.
can anybody guide me through the process?

Related

FATFS integration on SPI NAND FLASH

I'm trying to integrate FATFS file system on Micron NAND SPI FLASH. I'm using the SPI peripheral of the STM32L486RG as interface.
I have developped a low level driver through which I'm able to read, write and erase data from different locations in the NAND memory.
I have then integrated my Low-level driver APIs under diskio.c file in order they could be used by fatfs APIs.
I have successfully formatted the memory through f_mkfs (I'm getting FR_OK with both f_mkfs and f_open APIs and when debugging the fs object is containing the FAT signature).
However, when I try to write buffer into the file that I have created using f_oprn , I get "FR_INT_ERR" .
I have debugged my code step by step and I found that my get_fat function returns (1) as result which means that an internal error has occurred .
Any idea what could be the issue ?
I guess you need to erase the memory's sector you mean to write in - even though you write per pages and not per entire sector - and that's why using FatFs becomes tricky in NAND Flash.
Since your purpose is to bound the logical drive to the entire physical drive, you need to use the option ( FM_SDF | FM_ANY ) for the parameter opt into the f_mkfs function to format the memory.

Read and Write Image Block into DDR using Vivado IP Block

We are working on project where we need to do some image processing on FPGA. For that purpose we are using ZedBoard with linaro (Ubuntu Version) running on it.
What we have already done is we have stored the image in binary form pixel by pixel in DDR using python script on Processing System of Zedboard.
Now our task is to read the content of DDR memory, process it and send back the processed output to DDR Memory again. We are using vivado xilinx tool for FPGA part. We tried to use AXI-DMA with AXI-Interconnect to read and write data from DDR.
My question is, Do We need to use SDK and some sort of C coding to read and write DDR Memory on Programmable Logic side? As we want to make our module start reading the data from DDR with a control signal and then start actual processing of Image data. Once we read specific block of data, process it and store the result back to DDR memory on the fly. We are not sure which IP Block do we need in our block design for vivado. Also do we need Block Ram Memory at the end before sending the date to DDR.
Can anyone who already done this sort of project or have any knowledge ? Any help from your side will be appreciated !
Thanks
The zynq FPGA provide an AMBA AXI interconnect for that purpose.
This is the interconnect on the right.

Memory and mass storage capability in Java Card

I am developing a cardlet in Java Card and I need to store a lot of data.
Concerning the card's technical key features I can read:
78Ko EEPROM
Min. 2GB flash memory
My question concerns the flash memory access : How to store datas into it ?
In my applet, I instantiate persistants byte arrays to store my datas but proceding this way, I use the EEPROM.
I'm discovering smart cards and I'm a little lost.
You can test if the optional package javacardx.external.MemoryAccess is implemented to gain access. You won't be able to directly use the memory for your Applet.
To you use it you would probably have to execute something similar to:
javacardx.external.Memory.getMemoryAccessInstance(MEMORY_TYPE_EXTENDED_STORE, short[] memorySize, short memorySizeOffset)
Note that the Java Card implementation is mainly concerned with security applications. Storing data directly in unprotected flash is probably not the way to go.
The manufacturer may have implemented a proprietary API to access the flash. Better ask your vendor if the above solution does not work.

How to Raspberry pi main memory (Read and write)

I want to access raspberry pi's main memory, I have learned all basic stuff related to the device from Baking Pi website. So far i was working on registers, but now I want to have access to device's main memory. The problem is that i do not know the base address of main memory from where i can start working reading and writing.
I have made a lot of search but Google always points towards GPIO and other stuff.
If someone can please provide me the base address or any web link from where i could know how to continue, Thanks
Did you read the bcm2835 data sheet?
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCkQFjAA&url=http%3A%2F%2Fwww.raspberrypi.org%2Fwp-content%2Fuploads%2F2012%2F02%2FBCM2835-ARM-Peripherals.pdf&ei=QBpSU_m_Jqan8gGV-YDoBQ&usg=AFQjCNHP-j0e8vqALoieF5shMbgPaYcYEg&sig2=bVJ9mqBrcV4xH3FWAfhJGQ&bvm=bv.65058239,d.aWw

What exactly is a character driver ?

I know the definition
A character device driver is one that transfers data directly to and
from a user process.
But can some one explain this in a more intutive way? First of all there should be a device. What is the device in the above definition?
If you say it can be a file, then can we say file reading and putting the data on the console an example of character driver?
What exactly is a character driver ?
Device driver is Integration of two pieces of code. First piece of code is how the driver services are made available to the application.(user space)
Second piece of code is the hardware access part. Instructions to carry out physical operation on target hardware.
Based on first piece of code we have three models. Character model, Block model, Network model. we can say character driver, block driver, Network driver.
First piece of code is totally kernel specific. what Interface kernel provides to access the hardware. Implementing first piece of code on Linux,windows on other os may be different. we should know what inteface it offers to provide services to application .
In linux From user perspective everyhardware is a file. Why means at boot time all the hardware devices present are detected and added to device tree. Based on hardware corresponding device node gets created automatically in /dev directory. As mentioned above if it is char device---> character device node. Block device---> block device node gets created.
To write character driver. we create a device node in /dev directory , assigning a major no and application usually performing read/write operations on device file.
We implement driver operations and assign driver operations to file structure (fops) pointer.
Device file request received by VFS. VFS turns device file operations into your corresponding driver operations.
APP--->dev file----> fops--->driver---->device.
dev file ---> interface between application and driver.
driver interacts ----> device
You can refer http://lwn.net/images/pdf/LDD3/ch03.pdf.
According to my knowledge,
The device can be your own private structure or system object.
The driver is said to be a char driver because the data read and write is in byte range
If you are writing your char driver you can use char buffer or kfifo to read and write into the device.
you can create your device file in procfs,
and can read/write as u wish and this is accomplished though your char driver
I hope that my answer helps you
Think of device driver as abstraction of various hardware that the kernel has to deal with. The device driver knows the details of hardware it is communicating with. So the kernel reads and writes data as it would do with any other filesystem file.
If you can make some reading on Device Drivers, you will find out that the system calls of fopen, read, write, fclose are all mapped to driver specific function calls.
There is 2 types of drivers: block driver and char driver. The difference is that first one handles with blocks of data and second one receives/transmits data byte by byte.
Ok, for example you have a device and you want to talk to it, how to do it?
You have a driver, simply a number of functions, that will be called by the kernel at the right time. Driver itself can't do anything (neither send data, nor receive data), you need to say your driver what it should do. As you should know so far, you can't discretely communicate with a kernel from user space. There are some tricks that you can use. What you are talking about named as device file. Your driver generates a file for your device and when you write something to this file from user space, driver is notified that it is some information to handle, it takes this information and provide this data to write function, that will transmit data to your device(in this case byte by bite).
Hopefully, this what you wanted to know.

Resources