I am trying to write C test code for SPI peripheral module for Pulpissimo.I have gone through the test case mentioned in pulp-rt examples.
[https://github.com/pulp-platform/pulp-rt-examples/tree/master/periph/spim][1]
But I understand that the above code need the support of an external board. I have no board available with me. Is there any way to write test case in C for SPI?
I dont think that you will find a spi emulator supporting c language.
SPI is a 3 wire interfaces using clock/data in / data out (more bits can be used like chip select and others, but basic is 3 pins).
C is a programming language that will generate a binary file, not interpreted, so probably not the best language for a emulator.
The best that you can probably find is a microcontroller emulator that support an oscillator in virtual GPIO pins, but i dont know any.
As Rovert Harvey told you, the best that you can do is buy a board, but you dont need to spend 100 euros, just buy a ESP8266 board with wifi , spi, and other stuff for 2 euros/dollars. Then use arduino ide, they use .ine files that are a light modification of .c files and it supports .c files too.
Related
I was wondering how I can write my C code (just one single .c with a couple of different functions) into just two functions with inputs and outputs.
I am looking for these because I am going two put some part of my code into CPU and leave the other in FPGA, they can communicate with each other via the interface in Zynq family board (e.g. ZC706).
In this regards, via the Vivado HLS, I have to have just one single Function which can be translated to e.g. VHDL via the Vivado HLS and the other function can stay in CPU.
Thanks in advance and if needed can share my code.
Not at all!
There are no pthreads or functions in FPGA.
You must think the FPGA is more like a circuit. There are physical connections like wires. Internally especially in the Zynq family you can communicate through the RAM, DMA controllers or via Registers.
There is documentation from Xilinx, what you need is AXI/AXI Stream.
But what you want to do is writing any C code and run them in the FPGA area like in a processor. And this approach is not promising.
In Vivado HLS you can write "functions" in C/C++/OpenCL/SystemC but it is only a block with inputs and outputs translated to a hardware description language (VHDL/Verilog).
You have to export it and add it in your Vivado Project to use it.
At this point maybe your IP created in HLS will do something you expect, but there is still a lot of work todo connecting the Ports in the right manner.
My advice is get familiar with the Zynq family and especially the AXI protocol. If you feel familiar with DMA/AXI4/AXI4S and how to access them from ARM and Logic then start using HLS. Otherwise you will not have the feeling how to write code HLS understands.
I know how to program an AVR using a programmer. I am now wanting to learn Ruby and I thought it might be fun interacting with an Arduino or just an Attiny85 directly from the serial port.
I am kind of new to this stuff. Is there a way to control LEDs, servos and other components without burning a program directly to the AVR chip?
Would it make sense to write a Ruby program that connects to the AVR or Arduino through a serial connection and controls components? I didn't know if this was possible. Any ideas on how this can be done? I see that there is a serial port gem for Ruby. Would this be a good starting point?
I didn't know if this would be a good idea with Ruby.
You will need to flash the AVR with a program that interprets commands coming over serial from your Ruby program and takes the desired action.
One option is the Firmata protocol. There is a Firmata Arduino library:
https://github.com/firmata/arduino
Some Firmata client libraries for Ruby are listed at that link. I haven't used it but that seems like a fast way to achieve your goal, though you may have more fun designing your own command protocol and writing the microcontroller firmware from scratch.
I am taking Arduino Prototype code used for a DS3231 RTC and taking it to an embedded platform that does not directly support Arduino code (right now that is the Atmel Xplained Mini). Is there a way for me to create an equivalent program without writing an entire I2C protocol and the entire data communication from scratch? There must be an overlapping library/header/code block that I can adapt to my purpose.
As an example I am looking to make the code here work on the Atmel Xplained Board. The code should be pretty simple, what I need is for the DS3231 to tell the MCU the time when it asks for it. I can do the manipulation of the date/time myself, it is getting that information on a non-Arduino platform that is the road block for me.
Arduino has an existing wiring library that facilitates I2C communication, most professional development frameworks aren't quite so simple but are also more full-featured. I'm assuming you are using Atmel Studio, you'll want to look at the TWI (two-wire interface) documentation for doing I2C communication.
AVR315: Using the TWI Module as I2C Master
You can copy TWI_Master.c and TWI_Master.h to your project and use these for I2C communication. That is what I've typically done in the past.
The demo code that goes with this app note can be found here, main.c has an example of the usage of this I2C driver:
AVR315 Demo Code
I am trying to send data from a Kamstrup Multical 601 to an Arduino Uno using the M-bus protocol.
I am considering trying to use the libmbus c libraries to do this. However, I do not have a lot of experience in c programming so was wondering if:
you think this is a realistic/achievable approach?
anyone could suggest an alternative/easier approach?
The main chip on the Arduino Uno is the Atmel Atmega382P-PU.
After getting the data to the Arduino I aim to perform some calculations and send data to an LCD (this I think I can do).
On the Arduino Website there is a short how-to about the use of external C-Libraries with Arduino.
Note that you cannot simply connect M-Bus with a RS-232 interface. There is a so called "level-shifter" device necessary inbetween to do the "electrical transition". See the EN 13757-2 standard doucment for what this device is exactly doing with the signal. Without such a device you won't get any word out of your M-Bus device.
The library you link to appears to be for Linux. The Arduino, of course, doesn't run Linux so a library won't compile for it directly.
You should probably try implementing the library yourself, but using the Arduino's standard libraries to access ports and so on.
I have project to do. Which requires that I use FPGA. The theme is, that I need to create a circuit in FPGA using VHDL which would perform some task like multiplication or division. And then I need to send the input data from PowerPC(Built in Microcontroller in Virtex 4) to that circuit and then collect the data from output of FPGA circuit using PowerPC. I have tried looking at the manuals but failed to understand the communication between FPGA circuit and Microcontroller.
Google didn't help too..
Please let me know, if there is a book or a better tutorial which can help me in this project. Thanks in advance for your concern.
Note: I am using Virtex-4 ml403 FPGA board.
Thanks Again.
Take a look at Xapp717 from Xilinx.
http://www.xilinx.com/support/documentation/application_notes/xapp717.pdf
In the introduction it specifically mentions what you are trying to do. The APU in this context refers to the PowerPC.
This application note introduces the APU and describes the main features of an APU-enhanced
system. Included examples illustrate how the APU transfers data between the processor and
the FPGA. The two examples are:
• A simple system that moves data from memory through the processor and APU, into
registers in the FPGA, and back into memory
Source code is included (Xilinx login required)
http://www.xilinx.com/bvdocs/appnotes/xapp717.zip
Our software Impulse C will automatically make the bus connection to the PPC. You're welcome to try it for free. If you are interested send your Ethernet MAC to me or to info at ImpulseC and we'll get you started.
Best,
Brian
Do you need to implement a multiplier/divider to accelerate computing using FPGA? If so, you should design a multiplier/divider with VHDL code. Maybe using Xilinx IP core is the most convenient way. All you need to do is specify the parameter you want (e.g. input numbers are 32-bit). Synthesize your design and assign input/output pins. Then you can transfer data between PowerPC and FPGA through these pins.