Posts | Comments

Planet Arduino

Archive for the ‘intel’ Category

All of the tools you need to work with the FPGA Arduino — the Vidor — are now in the wild!

We reported earlier that a series of French blog posts finally showed how all the pieces fit together to program the FPGA on the Arduino MKR4000 Vidor board. Of course, I wasn’t content to just read the Google translation, I had to break out the board and try myself.

I created a very simple starter template, a tool in C to do the bitstream conversion, required, and bundled it all together in one place. Here’s how you can use my starter kit to do your own FPGA designs using the Vidor. I’m going to assume you know about FPGA basics and Verilog. If you don’t, why not check out the FPGA boot camps first?

The first thing you’ll want to do is grab my GitHub repo. You’ll also need the Arduino IDE (a recent copy) and Intel’s Quartus software. Inside, you’ll find three directories, two of which contain slightly modified copies of original Arduino files. But before you start digging in, let’s get the high-level overview of the process.

Basic Concepts

The FPGA onboard the Vidor is an Intel/Altera device so to configure it, we’ll use Quartus. Usually, Quartus handles everything including programming the device, but we can’t use it for that with the Vidor. Instead, we will have to tell the CPU how we want the FPGA configured and it will do it for us as part of our Arduino program (I really hate saying sketch).

Quartus (see below) will take our Verilog files and create a ttf file that represents the configuration bitstream. This is just an ASCII text file full of decimal numbers. Unfortunately, the way the Vidor is set up, it needs the numbers bit reversed at the byte level. That is, 01 in the ttf file needs to be 80 hex sent to the FPGA.

Arduino supplies a Java class file to do the task, but I got frustrated because the class file needed Java 11 and I didn’t want to put it on every machine I use, so I just rewrote it in C. It is easy enough to port the algorithm, though. In the shell subdirectory, I have another example implementation using awk.

Once you have this stream of numbers, you can include it in an Arduino sketch with some boilerplate to enable the FPGA and load it. The standard program includes the file app.h which is just the output of the conversion program. There’s no C code in it, just comma-separated numbers that the main code will stick in an array at compile-time. Beyond that, it is a normal Arduino program and you can do what you like. Upload it and you’ll get the CPU and FPGA programmed all in one go.

There is one caveat. The FPGA code has a top-level block with lots of I/O pins defined and the corresponding constraints. You should be very careful not to change these or alter the pin constraints. If you drive a pin that’s already an output, for example, you could do real harm to the board. Because all the pins are shared, you have the same problem with the Arduino pins, too. If you are driving an output pin with the FPGA, you shouldn’t try to drive it with the CPU also. However, as you will see, it is perfectly fine to have the FPGA reading a pin from the CPU or vice versa. That’s good because it gives us a way to send data back and forth between them.

On to Code

I wanted something simple, and I didn’t want to accidentally modify the Arduino boilerplate Verilog. You could instantiate a Verilog module, but this would require passing all the I/O pins into the module or modifying the original code every time, both of which I wanted to avoid.

My answer was to use the Verilog `include directive inside the boilerplate. That way your code has access to everything the main module has, but you don’t have to change the main module. The only downside is that Quartus has a smart compile feature that can’t figure out when only an include file changes. So it wasn’t recompiling when I made changes. I turned that feature off in the Quartus options, so if you pick up my example project, you won’t have any problems.

Here’s my example user.v:

reg [27:0] hadcounter;
assign bMKR_D[6]=bMKR_D[5]?hadcounter[27]:hadcounter[21];

always @(posedge wOSC_CLK)
begin
   if (!rRESETCNT[5])
   begin
      hadcounter<=28'hfffffff;
   end
   else
   begin
      if (hadcounter==28'h0) hadcounter<=28'hffffffff; else hadcounter<=hadcounter-28'h1;
   end
end

In the real file, I left a lot of comments in that explains what all the main module has that you can use. But the above is the working part. I define a 28 bit counter. The bMKR_D array is the digital ports for the Arduino and I’m using pin 6 and 5 as an output and an input, respectively.

The assign statement says, in English, If D5 is high, connect the 27th bit of the counter to the LED. If it is low, connect the 21st bit. The rest of the code just makes the counter countdown. I reload the counter even though it would naturally roll over in case you want to fine tune it to a different frequency.

As the counter runs, bit 27 will toggle relatively slowly, but bit 21 will be a good bit faster — that’s just how a counter is. So by changing D5 you can make the LED blink slow or fast.

As Verilog goes, this isn’t very complicated or even useful, but it is simple and shows that we can share data with the CPU in both directions. If you open the example project in Quartus, all you really need to do is make any changes to user.v you like, add any other files you want to use and double-click the Compile Design task (see left). If you get a successful compile, you’ll find the ttf file in the output_files directory. That’s the file you need to process with either the Java program, the C program, or the awk script. Either way, collect the output as app.h and put it in the same directory as your Arduino code.

CPU Side

On the sketch side, you need to leave the template code alone since it turns on the FPGA clock, among other things. You’ll notice it also includes app.h and uses a file called jtag.c to communicate with the FPGA. I didn’t segregate the Arduino code into its own include because you probably have to change the setup function, and make changes in global space, but that could be arranged (perhaps make setup call cpu_setup and loop call cpu_loop or something).

If you want to remove the demo parts of the blink-sketch file, you can get rid of:

  • The definitions and calls related to FPGAVal, SPEED, and FPGALED
  • The Serial calls and definitions
  • Everything in the loop function

I left the unmodified code in the EmptySketch directory. Note in the demo code, though that SPEED is an output. This is set to D5, which is an input to the FPGA. By the same token, FPGALED corresponds to D6 and allows the CPU to read the state of the LED output.

You will need an LED and dropping resistor on pin 6 unless you want to watch with a scope or a meter. I always keep some LEDs with built-in 5V dropping resistors handy, and even at 3.3V it was plenty bright. With one of those, you can just stick the wires right into the header socket on the board. Don’t try that with a regular LED, though!

Once you run the sketch, you can open the serial monitor or any terminal at 9600 baud. There will be a message saying you can press any key to change the blink rate. Of course, since the serial monitor doesn’t allow you to press keys exactly, you’ll have to enter something and hit enter (set “No line ending” at the bottom of the monitor screen), but on a real terminal, any character press should do it.

The main code is pretty simple:

void loop() {
static int oldstate=-1;
static int linect=0;
int state;
if (Serial.read()!=-1)
  {
  FPGAVal=FPGAVal==HIGH?LOW:HIGH;
  digitalWrite(SPEED,FPGAVal);
  }
state=digitalRead(FPGALED);
if (state!=oldstate)
  {
  Serial.print(state);
  if (++linect==16)
    {
    Serial.println();
    linect=0;
    }
  oldstate=state;
  }
}

In the loop, if serial data appears, we just toggle the output going to the FPGA. We also sample the LED output on every pass. If it has changed from the last time, we write the new state to the terminal and then update the state so we don’t flood the screen with repeated characters. A lot of the code is just tracking when we’ve written enough to start a new line.

Vidor’s Hello World

I wanted to get everything you needed in one place and an example that would be easy to follow yet show the critical working parts. It would be easy enough to use the shared I/O pins to do SPI, for example, and then you could trade data with the FPGA quite easily. Don’t forget there’s Arduino IP (intellectual property; sort of library subroutines for FPGAs) in the IP directory, too, if you want to use it.

Now you just need a project idea that makes sense for an FPGA. Our personal favorite would be a logic analyzer. The CPU can talk to the PC, set up triggers and then let the FPGA do the dirty work of finding the trigger and storing data as fast as possible. If you want something less ambitious, it is very simple to create totally autonomous PWM outputs on an FPGA. We could see this being handy for robotics or machine control where you want a very rapid sequence of outputs without CPU intervention or overhead.

Of course, not every project has to make sense. If you are just wanting to learn about FPGAs there are plenty of projects you could do with a CPU but are easy enough to build in an FPGA (the classic traffic light comes to mind). Of course, with the Vidor you have an opportunity to use a blend of FPGA code and CPU code, which is kind of the point.

Alorium rolled out a new product late last year that caught our attention. The Sno (pronounced like “snow”) board is a tiny footprint Arduino board that you can see in the video below. By itself that isn’t that interesting, but the Sno also has an Altera/Intel Max 10 FPGA onboard. If you aren’t an FPGA user, don’t tune out yet, though, because while you can customize the FPGA in several ways, you don’t have to.

Like Alorium’s XLR8 product, the FPGA comes with preprogrammed functions and a matching Arduino API to use them. In particular, there are modules to do analog to digital conversion, servo control, operate NeoPixels, and do floating point math.

However, you can reprogram the FPGA to have other functions — known as XBs or Xcelerator Blocks — if you like. The only problem we see is that, so far, there aren’t many of them. In addition to the stock XBs, there is one that will do quadrature decoding for dealing with things like shaft encoders. There are a few others you can find on their GitHub page. You can get an idea for the workflow by looking at this tutorial for the XLR8 board.

Of course, you can write your own FPGA configurations as you see fit, but they also provide a standard workflow — OpenXLR8 — that lets you build your own blocks that operate just like their blocks. It would be easy to imagine an “app store” concept where people develop custom blocks and make them available.

We really like the idea of this device and it is certainly inexpensive. You can prototype on the XLR8 which looks like a UNO or you can put headers in the Sno. They also sell a breakout board that will make the Sno physically more like an UNO. We are surprised, though, that there are not more XBs created over the last two years.

The FPGA onboard is similar to the one on the Arrow board we looked at earlier this year, although that has some additional components like SDRAM. If you are looking for a project, it might be interesting to convert our PWM code into an XB.

Thanks to [K5STV] for showing us one of these.

Maker pros showcase exactly how difficult it is to make hardware, but promote how much easier it is to become a Kickstarter star.

Read more on MAKE

The post Maker Pro News: Hardware is Still Hard, The Rise of Re-Kickstarting, and More appeared first on Make: DIY Projects and Ideas for Makers.

101

A few weeks ago, an announcement was posted on the Arduino Forum mentioning new improvements on the software side of the Arduino/Genuino 101. With this release, the board–which was developed in collaboration with Intel–is reaching its full potential, with not only better code generation but unlocking useful features to make your sketches even more interactive as well.

You can easily upgrade the core using the Arduino IDE’s Board Manager (pictured below), while Arduino Create users will be automatically updated, so no action is required–the cool thing about the cloud!

Core-package

In more detail:

  • The GCC compiler has been updated to support hardware extensions to the ARC EM core in the Intel® Curie™ module. This provides significant improvements in floating point operations, bit shifting, and other operations to enhance Sketch performance.
  • The Arduino/Genuino 101 platform offers 2MB Flash storage onboard, which is now enabled for user sketches.
  • An experimental driver has been implemented to enable the I2S interface via the CurieI2S library. Connecting the I2S bus to an external DAC (digital to analog converter) allows users to play high-quality music (HiFi).

Other improvements and bug fixes:

  • Motion Sensor: Several sample sketches, like MotionDetection, have been implemented to demonstrate the application of the IMU data
  • Bluetooth LE: Several new examples for BLE peripheral library added
  • IMU: Correct motion detection setting implemented
  • Library CurieTimerOne APIs are now compatible with the TimerOne library

For comprehensive release notes refer to the Intel Open Source Technology Center on GitHub.

Everyone’s favorite safety-tie-wearing-eccentric-inventor, [Colin Furze], is back at it again, this time making a flamethrower guitar — sponsored by Intel!?

As an ex-plumber, [Furze] is a master fabricator, and he’s brought many amazing mechanical inventions to life. In this video, perhaps for the first time, he’s integrated an Intel Curie Arduino in it, for a bit more fine control.

He’s hacked apart a couple of propane blow-torches, milled and lathed his own fittings and manifolds, and even TIG welded together a pressure vessel for the fuel — kids, do not try this at home!

The two blowtorches act as pilot lights for a third gas supply line to make the big firing explosion — the plan for the Arduino? To blast off the fire at certain parts during the song, add timing, or even just set up some cool patterns.

Did we mention he’s also got his own custom propane fueled guitar amp to go with it??

[Caleb’s] going to want to beef up his flamethrower ukulele if he wants to go toe-to-toe with [Colin]! Stay tuned for next week when he tests it out.


Filed under: Arduino Hacks

In support of the TBS show “America’s Greatest Makers,” YouTuber/plumber/stuntman/inventor Colin Furze recently took on the challenge of turning a bass guitar into a flamethrower with the help of a Genuino 101. Because after all, there’s nothing more metal than fire bursting as a rockstar shreds on-stage.

To bring this project life, Fruze added a pair of modified blow torches to the neck of the guitar and sawed off part of the instrument’s base to fit in the firing mechanisms. As you can see in his tutorial video below, the body is equipped with a gas reservoir on top, solenoid valves, a few switches, a gas supply to the blow torches, an inlet pipe, and some other components.

The Maker even converted his amp to house a gas tank, along with a speaker, the Genuino board and a relay shield that enables him to synchronize flames to certain musical patterns and sequences.

It goes without saying that you may not want to try this at home…

In support of the TBS show “America’s Greatest Makers,” YouTuber/plumber/stuntman/inventor Colin Furze recently took on the challenge of turning a bass guitar into a flamethrower with the help of a Genuino 101. Because after all, there’s nothing more metal than fire bursting as a rockstar shreds on-stage.

To bring this project life, Fruze added a pair of modified blow torches to the neck of the guitar and sawed off part of the instrument’s base to fit in the firing mechanisms. As you can see in his tutorial video below, the body is equipped with a gas reservoir on top, solenoid valves, a few switches, a gas supply to the blow torches, an inlet pipe, and some other components.

The Maker even converted his amp to house a gas tank, along with a speaker, the Genuino board and a relay shield that enables him to synchronize flames to certain musical patterns and sequences.

It goes without saying that you may not want to try this at home…

Wafer level chips are cheap and very tiny, but as [Kevin Darrah] shows, vulnerable to bright light without the protective plastic casings standard on other chip packages.

We covered a similar phenomenon when the Raspberry Pi 2 came out. A user was taking photos of his Pi to document a project. Whenever his camera flash went off, it would reset the board.

[Kevin] got a new Arduino 101 board into his lab. The board has a processor from Intel, an accelerometer, and Bluetooth Low Energy out of the box while staying within the same relative price bracket as the Atmel versions. He was admiring the board, when he noticed that one of the components glittered under the light. Curious, he pulled open the schematic for the board, and found that it was the chip that switched power between the barrel jack and the USB. Not only that, it was a wafer level package.

So, he got out his camera and a laser. Sure enough, both would cause the power to drop off for as long as the package was exposed to the strong light. The Raspberry Pi foundation later wrote about this phenomenon in more detail. They say it won’t affect normal use, but if you’re going to expose your device to high energy light, simply put it inside a case or cover the chip with tape, Sugru, or a non-conductive paint to shield it.


Filed under: Arduino Hacks

mbanzi-agm

Last night Massimo Banzi was Guest Judge on Intel  America’s Greatest Maker - episode 4 and had the difficult task of evaluating the teams and their projects competing in the Make or Break rounds for $100,000 and a spot in the million dollar finale.

Check some bits of the episode in this Meet and Greet video and in the Fast Forward of the episode!

americagm

Massimo Banzi is among the judges on “America’s Greatest Makers” a reality competition from Mark Burnett (the reality-TV king behind “Survivor,” “The Apprentice,” and “The Voice”) in partnership with Intel which debuted last week on TBS.

In a first of its kind competition, the tv show takes 24 teams of makers from across US and puts them in head-to-head challenges to invent disruptive projects and win $1 million. The team are composed by unique people from 15 years old to 59 with ideas going to inspire a whole new audience of potential makers.

Intel_AGM_stacked_rgb_3000

 

In the first two episodes, each team pitched their device idea to the judging panel composed by Intel CEO Brian Krzanich; business and financial expert Carol Roth; comedian, serial entrepreneur and co-host of truTV’s Hack My Life Kevin Pereira; and one of the celebrity guests.

At the end of April during 4th episode guest judge Massimo Banzi joins the panel as the remaining makers compete in the “Make or Break” rounds for $100,000 and a spot in the million dollar finale. If you are not in the USA, watch the episode at this link after April 27th.

mbanziagm

In the meanwhile you can also watch a beginner maker project to learn how to do obstacle avoidance using Arduino 101. Cara Santa Maria is the trainer who’s going to guide you into the tutorial about this really important topic for projects involving moving objects like robots and drones:

Arduino101Tut-Intel

 

Follow the show on Twitter, Instagram, Facebook and use hashtag #AmericasGreatestMakers

 



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook