Close
0%
0%

BlackMath

"BlackMath" is a small DSP board, based on Blackfin BF592A, using an Arduino-compatible as loader and PC interface.

Public Chat
Similar projects worth following
The BlackMath board uses an Arduino-compatible board as loader and PC interface, but can operate independently. The goal is to use GCC and Arduino to replace the Analog Devices tools.

The BlackMath is a platform for Digital Signal Processing learning and teaching. The goal is not to be a fancy board, but to offer the bare minimum to be usable, without the need for proprietary tools.


The Arduino-compatible board takes the place of a Analog Devices' JTAG and GCC is used, instead of Cross Core or VisualDSP++.

The BF592 is a very capable chip, despite its clock and memory limitations:
Memory Type
Size
Instructions RAM
32kB
Instructions ROM
64kB
Data RAM
32kB
Scratchpad data RAM
4kB
BootROM4kB

Fortunately, AD provided a good range of functions embedded on its 64kB of ROM. This saves precious program space and ensures the programs performance.

The board has an SPI Flash, used to store data or programs. A "jumper" selects the boot mode: internal SPI Flash or external Arduino guided.

The SGTL5000 codec was used just for its price tag. Thinking about it now, it's a a certain waste of resources, because we will no use all of the available functions. It is connected to BF592 by the SPI interface.

There is an expansion connector, where the student can plug in some sort of adaptor, to read some other signal that not audio: ECG, EEG, 4~20mA etc...

The P10 connectors were choosen by its mechanical characterstics, but the microphone conn is a P2.

The display is an OLED type, the cheapest found on AliExpress.

There is an JTAG port, for the initial tests, but the goal is to use only free tools: GCC as the mais compiler and an Arduino board to load the DSP main program.

WARNING: the board only accepts 3,3V signaling. The Arduino-campatible board has to work at this voltage. I used a Wemos D1.

Besides the board, a software framework will be available. All the low-level configuration, the ping-pong buffers, communications interface etc... will be handled by the BlackMath framework.


You can find the files at https://github.com/marcelluspereira/blackmath

BlackMathPCB.pdf

This is the first version of the project. But be aware that are some errors.

Adobe Portable Document Format - 1.21 MB - 11/16/2018 at 20:06

Preview
Download

  • Serial Loader for BlackMath v1.0

    Marcellus Pereira02/05/2019 at 00:00 0 comments

    As you know, the BM version 1.0 is incapable of boot from the Arduino connected SPI.

    Until the new boards arrive, I built a small kludge: using and USB<->RS232C adapter, we can set the BM to boot from UART, as you can see below.

    The adapter can be anyone, as long it works with 3.3V.

    Download the Windows program from github and upload your LDR files to the board. This is just a temporary fix, until I get the new boards, with all corrections.

    In the repository there is a test program, displaying some imagens and speed tests.

  • Some tests and pitfalls

    Marcellus Pereira11/16/2018 at 20:58 0 comments

    Well, this first version of the board has it's flaws, but I could run some tests.

    I used the Analog Devices JTAG tool to load 2204, 16 bit audio samples and a simple 100 taps convolution filter. Then, I rewrote the code using the BF592 ROM routines and compared the results: from 64ms to 0,6ms.

    Of course, the convolution filter used an academic code, but, yet, I think this will amaze the students.

    The downside of the test: I discovered that the CODEC SGTL5000, when wired to SPI interface, can not be read. So, I thought I could use the chip ID register to just test the SPI interface but that is impossible.

    I wrote a simple Arduino program to receive the LDR file and store it, in the hope to use it to boot the DSP. But I chose the UART as the main boot interface (from Arduino to DSP), and forgot that Arduino uses it as its main PC interface.

    Now, I will have to write a small bootloader, load it in the BlackMath's SPI Flash and use the second SPI, attached to Arduino, to read the LDR binary.

    Just as curiosity, the Arduino code (based on multiple internet sources),  is as follows:

    /*
       Copyright (c) 2015, Majenko Technologies
       All rights reserved.
    
       Redistribution and use in source and binary forms, with or without modification,
       are permitted provided that the following conditions are met:
    
     * * Redistributions of source code must retain the above copyright notice, this
         list of conditions and the following disclaimer.
    
     * * Redistributions in binary form must reproduce the above copyright notice, this
         list of conditions and the following disclaimer in the documentation and/or
         other materials provided with the distribution.
    
     * * Neither the name of Majenko Technologies nor the names of its
         contributors may be used to endorse or promote products derived from
         this software without specific prior written permission.
    
       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
       ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
       DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
       ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
       ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
       SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    /*
    Modified by Marcellus Pereira <marcellus at laboratoriosacme.net>
    */
    
    #include <ESP8266WiFi.h>
    #include <WiFiClient.h>
    #include <ESP8266WebServer.h>
    #include <ESP8266mDNS.h>
    #include <FS.h>   // Include the SPIFFS library 
    
    const char *ssid = "myssid";
    const char *password = "mypassword";
    
    ESP8266WebServer server(80);
    
    const int led = 14;
    const char page[] = {"<html><head><title></title></head><body><h1 style=\"text-align: center;\"><span style=\"font-family:courier new,courier,monospace;\"><strong>BlackMath</strong></span></h1><p><span style=\"font-family:courier new,courier,monospace;\">Atualização de firmware.</span></p><form action=\"update\" enctype=\"multipart/form-data\" method=\"post\">Arquivo ldr: <input id=\"fileToUpload\" name=\"fileToUpload\" type=\"file\" /> <input name=\"submit\" type=\"submit\" value=\"Atualizar\" /> </form><p> </p></body></html>"};
    
    
    File fsUploadFile;              // a File object to temporarily store the received file
    
    void handleRoot() {
      digitalWrite(led, 1);
      char temp[600];
      int sec = millis() / 1000;
      int min = sec / 60;
      int hr = min / 60;
    
      server.send(200, "text/html", page);
      digitalWrite(led, 0);
    }
    
    void handleNotFound() {
      digitalWrite(led, 1);
      String message = "File Not Found\n\n";
      message += "URI: ";
      message += server.uri();
      message += "\nMethod: ";
      message += (server.method() == HTTP_GET) ? "GET" : "POST"...
    Read more »

  • CODEC: first blood

    Marcellus Pereira11/04/2018 at 04:36 0 comments

    The BF592A initialization is working fine. The PLL is set and the mais clock is 193.577MHz.

    Unfortunately, the pin VDDD is currently tied to +3V3 but the datasheet says it have to be connected to 1.1 ~ 2.0V... let's see if the little cut can save it.


  • First boot with CODEC chip soldered

    Marcellus Pereira11/01/2018 at 02:50 0 comments

    Well, after some trouble with the SGTL5000 power pins, it seems that the little cut-and-rewire is working fine.

    I'm writing the driver, but the power regulators are ok, so, there are no short circuits.

View all 4 project logs

  • 1
    The easy way to configure the cross-compilation environment

    Well, you all know the version 1.0 of the board have some glitches. But it still can boot from UART port, even without the Arduino board. Unfortunately, my USB<->Serial converter uses 5V and I will not risk to fry the board.

    So, while the other converter are in transit, we will configure the development ambient. Shall we begin?

    We will use Eclipse IDE. I know, I know...  "Eclipse? Really?". Unfortunately, yes. But, looking for the bright side, we always can use the command line.

    I assume you are using Windows, but for the Linux guys, the process is almost the same.

    Download the Eclipse version LUNA. The Blackfin GNU Toolchain plugin is a little bit old and I could not put it to work with a more recent version.

    The 64 bit version is available at: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/RC1/eclipse-cpp-luna-RC1-win32-x86_64.zip

    Install it.

    Now, we will download the Blackfin Toolchain, but Eclipse will do the hardwork. Open Eclipse and click in Help/Install New Software.

    Add the following address: https://sourceforge.net/projects/adi-toolchain/files/eclipse/update_site/

    Select both "Blackfin Debug" and "Blackfin GNU Toolchain". In the picture, they are already installed.

    Eclipse will download and install it.

  • 2
    The first program

    To create and build our first program (or the following ones), there are simple steps to perform:

    * In Eclipse IDE, go to "File" / "New" / "C Project".

    * Select "Executable" / "Empty Project" / "Blackfin Bare Metal GNU Toolchain (bfin-elf)".

    * Choose a project name. "Blink LED", for example.

    * "Next".  "Next".

    * Chose the processor. In our case, the BF592. In the "Silicon Revision", try "any".

    *  "Finish".

    * Add a "C Source file" and write some code. To test our LED:

    /*
     * main.c
     *
     *  Created on: 22/12/2018
     *      Author: marcellus
     */
    
    #include <cdefBF592-A.h>
    #include <defBF59x_base.h>
    
    void main(void){
    	int i, n;
    
    	while(1){
    		//Zera pino PF10
    		*pPORTFIO_CLEAR = PF10;
    
    		for(i=0; i<900000; i++){
    			{asm("NOP;");}
    		}
    		//Seta pino PF10
    		*pPORTFIO_SET = PF10;
    		for(i=0; i<900000; i++){
    			{asm("NOP;");}
    		}
    	}
    }
    

    * Before the build, open the "Properties" panel, right-clicking over the project name. Em "Settings" / "Build Steps", write the following sentence, under the "Post-build steps":

    bfin-elf-ldr -T BF592 blinky.ldr blinky --bmode uart

    That's it. You can try to compile it now.

View all instructions

Enjoy this project?

Share

Discussions

DMazzer wrote 11/19/2018 at 18:34 point

Congratulations on this!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates