Giter Site home page Giter Site logo

arduino's Introduction

FPGArduino

Arduino core extensions for FPGA-based 32-bit MIPS and RISC-V soft CPU cores (f32c).

We have preliminary Boards Manager support. In File->Preferences->Additional Boards Manager URLs enter:

https://raw.githubusercontent.com/f32c/fpgarduino/master/package_f32c_core_index.json

Select pull down menu Tools->Board->Board Manager and instal FPGArduino (cca 100MB).

Arduino needs access to usbserial ports. When user who runs arduino is member of "dialout" groups, then this udev rules might be handy (example from scarab):

# /etc/udev/rules.d/80-fpga-ftdi.rules
# this is for usb-serial tty device
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", \
   MODE="664", GROUP="dialout"
# this is for ujprog libusb access
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", \
   GROUP="dialout", MODE="666"

Upgrading

Before upgrading to new version, boards manager cache has to be manually removed by deleting hidden directory 'packages'. If install is attempted with old cache, it will fail with CRC error.

windows cache: %appdata%/Arduino15/staging/packages (use Find files)
linux cache: ~/.arduino15/staging/packages
apple cache: ~/Library/Arduino15/staging/packages

Windows: %appdata%/Arduino15 (open File Explorer, enter %appdata% into the Address Bar and press Enter)

Delete packages directory, then remove/install from boards manager.

Troubleshooting

Windows 10 DLL problem: ujprog.exe has FTDI DLL dependency. Check this issue for a possible workaround: f32c/tools#4

Some boards need OpenOCD to upload bitstream. OpenOCD has libusb dependency which needs to be manually installed on windows. On Linux libusb is probably already installed. Install libusb on windows only if you need it. To install libusb on windows, easiest way is with Zadig http://zadig.akeo.ie Options->List All Devices Select usb serial device, select driver WinUSB and click install. Zadig is not needed for boards with own uploaders like ULX2S or FleaFPGA. Zadig can have some issues with FTDI drivers for windows 10. Uploader for Numato MimasV2 boards needs Python. On Linux, Python is already installed. On Windows, Python needs to be manually installed.

Manual install: Copy or symlink this to existing arduino directory (versions 1.6.0 and newer), close the Arduino IDE, open it again and new FPGA boards, progammers and examples should appear under pull down menus:

tools->boards->...new mips and riscv boards..

tools->programmers->...ujprog openocd etc...

file->examples->f32c->...

file->examples->...RCswitch...Adafruit GFX/SSD1306..

We had to do small modifications of original examples for AVR-specific or hardware-dependent stuff in order to get them running out of the box on f32c.

Source tree arduino/hardware/fpga contains complete arduino core for unified MIPS and RISC-V achitecture support. Only this directory is needed to be copied to your existing arduino-1.6.x tree. Core can work alone without libraries and examples.

The core comes without GCC for MIPS/RISC-V and tools to upload binary and FPGA bitstreams (ujprog, openocd, JTAGs).

Precompiled binaries for linux and windows with GCC MIPS and RISC-V can be fetched and installed separately, see https://github.com/f32c/fpgarduino for further instructions.

There are some short scripts and patches to build GCC from source in https://github.com/f32c/f32c/tree/master/src/compiler

What should work

Blink led :)

Serial (over usb-ttl adapter, some boards need it external)

Timer (millis(), micros() - 32-bit CPU core clock counter, glitch-free, good for realtime)

GPIO (digitalWrite(), digitalRead())

Interrupts (MIPS only, attachInterrupt() gpio rising/falling edge, timer)

PWM (analogWrite(), analogWriteResolution(), analogWriteFrequency())

Fade (PWM) works on 2 output pins (LEDs).

Software SPI (bitbang, Adafruit OLED library)

Hardware SPI (SD card library)

Software I2C in master mode (SoftwareWire library)

OLED displays SSD1306 compatible (Adafruit SSD1306 library, SPI and I2C)

PID (Proportional-Integral-Derivative controller, fast response, hardware math accellerated, tested on high speed DC motors with encoders)

433.92 MHz transmitter (RCswitch library, Home automation, Remote relays, Garage doors).

FM RDS transmitter 87-108 MHz (RDS message displayed on radio, but PCM sound supported only on ULX2S)

RHT11 Temperature/Humitidy sensors have been reported to work.

SRAM in 8-bit mode (FleaFPGA Uno) and 16-bit mode (ULX2S)

SDRAM in 16-bit mode (Altera DE0 nano, ReVerSE-U16 and Scarab MiniSpartan6+)

LPDDR, DDR, DDR2, DDR3 using Xilinx 7-series MIG and AXI. (ESA11 with DDR3)

What works only on some supported boards

VGA/HDMI/DVI/TV video and audio DMA need either large external RAM (SRAM, SDRAM or DDR) or sufficient BRAM (32K) for use with acram emulation.

Boards with supported external RAM are ULX2S, FleaFPGA Uno, Scarab Minispartan6+, Altera DE0 nano, ReVerSE-U16 and ESA11.

PCM sound depends on DMA. PCM outputs PWM for headphones and FM for reception on 87-108 MHz radio.

Text-to-Speech library TTS depends on PCM. TTS library could be converted to use a simple tongenerator then it will not depend on PCM)

DCF77 transmitter depends on PCM. A proof of concept to adjust longwave RF clocks.

Analog inputs work on FleaFPGA Uno board thanx for contribution.

Pullup digital input control works on FleaFPGA Uno board (it would work on any board but 2 hardware pins must be dedicated for 1 GPIO pin, one of them having pullup resistor)

What doesn't work yet

Hardware I2C slave is not planned soon, as f32c is expected to be an I2C master in most cases.

There's SoftwareWire I2C master which works because F32C is fast enough and has high resolution 32-bit timer.

arduino's People

Contributors

emard avatar gornjas avatar mhaghighi avatar xarklabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino's Issues

SPI example will not link

They used to compile, but now I don't know whazzup
examples->SPI->DigitalPotControl
/tmp/build1904330117572721905.tmp/DigitalPotControl.cpp.o: In function setup': (.text.setup+0x18): undefined reference toSPI'

BASIC as arduino library

BASIC interpreter for f32c could be packet as c++ library
and as such could be easily added to any arduino sketch.

Timer interrupt example doesn't compile

IDE: Arduino IDE 1.6.9
OS: Windows 10 x64

Description: Selecting "mips_timer" example under "f32c/interrupts" cannot compile because of following reason:

"VARIANT_MCK' was not declared in this scope

No serial output

This simple example does not return serial

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(19200);
}

void loop() {
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.println("5");
}

and this one is working

// initialize serial communication at 9600 bits per second:
Serial.begin(19200);
}

void loop() {
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.println("4");
}

Problem with compiling sketch in linux

Just did the example SerialEvent with baudrate changed to 19200. Here is the output:

/home/magnus/.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-ar rcs /tmp/build1860868207851946728.tmp/core.a /tmp/build1860868207851946728.tmp/UARTClass.cpp.o
/home/magnus/.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-ld -N -EL -gc-sections --library-path=/home/magnus/.arduino15/packages/FPGArduino/hardware/f32c/1.0.0/system/mips/lib -nostdlib --section-start=.init=0x400 -lcrt0 /tmp/build1860868207851946728.tmp/mySerialEvent.cpp.o /tmp/build1860868207851946728.tmp/core.a -lulx2s -lm -lc -o /tmp/build1860868207851946728.tmp/mySerialEvent.cpp.elf
/tmp/build1860868207851946728.tmp/mySerialEvent.cpp.o: In function _GLOBAL__sub_I_inputString': mySerialEvent.cpp:(.text.startup._GLOBAL__sub_I_inputString+0x28): undefined reference to__dso_handle'
mySerialEvent.cpp:(.text.startup._GLOBAL__sub_I_inputString+0x2c): undefined reference to __cxa_atexit' /tmp/build1860868207851946728.tmp/core.a(WString.cpp.o): In functionString::changeBuffer(unsigned int)':
(.text._ZN6String12changeBufferEj+0x1c): undefined reference to realloc' /home/magnus/.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-ld: /tmp/build1860868207851946728.tmp/mySerialEvent.cpp.elf: hidden symbol__dso_handle' isn't defined
/home/magnus/.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-ld: final link failed: Bad value
Error compiling.

RISC-V compilation fails

Hi!

The board manager already downloads gcc-7, but the compiler settings in platform.txt seem to be outdated. Right now it is not possible to compile for RISC-V.
image

I tried with -march=rv32i -mabi=ilp32 but i get still errors. If gcc-7 is unstable maybe it is better to revert to the previous toolchain?

Here are the compiler options for risc-v
https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Options.html

tools bin folder is empty

Cannot run program "C:\Users\gmahovlic\AppData\Roaming\Arduino15\packages\FPGArduino\tools\f32c-compiler\1.0.0\bin\mips-elf-g++" (in directory "."): CreateProcess error=2, The system cannot find the file specified

Incorrect library

Hello!
I have found ur library about 2 days and I have some problems with it.
I am using Spartan Start Kit S3E-500. I done all you said to see my board, I see it on Board Manager, and I see ujprog, so it seems to be correct.But when I try to compile any example I have a error (it is on white colour so it seems to be warning may be) incorrect library found in C:\Users\Acidka\AppData\Local\Arduino15\packages\FPGArduino\hardware\f32c\1.0.0\libraries\f32c: C:\Users\Acidka\AppData\Local\Arduino15\packages\FPGArduino\hardware\f32c\1.0.0\libraries\f32c
And there was some problems with paths on this path like bootloader foulder was in "tools" and he couldn't find it, but I replaced and he found. So if I try to load it it just do nothing.

Thanks for help,
Acridka.

MIPS gcc won't compile u8g, RISC-V compiles it

u8glib will not compile for MIPS gcc
actually compiles but mips-elf-objcopy fails

RISC-V compiles the same and works
tested on SSD1306 SPI (software)
in u8g.h section SW SPI, Arduino after teensy add this
#elif defined(__ F32C __) /* FPGArduino */
#define U8G_COM_SW_SPI u8g_com_arduino_std_sw_spi_fn
#define U8G_COM_ST7920_SW_SPI u8g_com_arduino_st7920_spi_fn

https://bintray.com/olikraus/u8glib/Arduino/view

u8glib_arduino_v1.18.1.zip
sha1: f90c3c338244ff872c9c94777d7d76be381788a6

In the Arduino IDE, import the ZIP library from the "Add Library" Menu.
compile any example .e.g. U8gLogo

.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-objcopy -O binary /tmp/build5698330625315358907.tmp/U8gLogo.cpp.elf /tmp/build5698330625315358907.tmp/U8gLogo.cpp.bin
BFD: Warning: Writing section .init' to huge (ie negative) file offset 0xffffffff7fc00000. BFD: Warning: Writing section.text' to huge (ie negative) file offset 0xffffffff7fc0005c.
BFD: Warning: Writing section .rodata' to huge (ie negative) file offset 0xffffffff7fc0222c. BFD: Warning: Writing section.ctors' to huge (ie negative) file offset 0xffffffff7fc0228c.
BFD: Warning: Writing section `.sdata' to huge (ie negative) file offset 0xffffffff7fc02290.

Arduino library for DHT11DHT22

Got it working, but needed to remove interrupts() and noInterrupts() function from DHT.cpp file

initialy I got this two errors errors:
'__enable_irq' was not declared in this scope
'__disable_irq' was not declared in this scope

Amazing work

Amazing work by you. It really acts as replacement for Wire in Master case. It really helped a lot.

GPIO INPUT register changed address

before, GPIO input register was on the same memory map
location as the GPIO output register,.

Now it's separate to enable better AVR compatibility

Simple_io, which is used for LEDs and pushbuttons, will
continue working as before. GPIO is more complex than
simple_io, as it supports bidirectional pins and interrupts

Old bitstreams currently don't yet follow latest GPIO change
introduced in our arduino core. It will take some time
until we to compile them all and distribute

In the meantime quick fix is to compile fresh f32c bitstream
from github source

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.