The ‘Hack-a-day’ effect

01/28/2013 Posted by admin

My STM32F4 Logic analyzer webpage was indirectly linked by hackaday.com on January 27th 2013.

(Lire la suite…)

Using STM32F4 as a logic analyser (SUMP/8channels/21Mhz) – (not 24Mhz)

12/20/2012 Posted by admin

or « Will my STM32F4-discovery board replace Arduino/Bus Pirate ? « …

Well I needed a logic analyzer to track some bugs in a project I am working on, but that could do more than the Bus Pirate OLS mode…

So I found this on the web : SUMP compatible logic analyzer code for Arduino.

But I also wanted a higher sampling rate.

- The code for the SUMP protocol was there from the Arduino project.
- I had the STM32F4 handy (the same I used for the MP3 – libmad port)
- The libopencm3 had a simple working example of a USB-CDC on the Discovery board

Go… Mixing everything in that code : here.
(you need libopencm3 in /opt/libopencm3)

Code update 28/04/2103 : Acquisition rate was in fact 21Mhz, there was a bug in function « cdcacm_data_rx_cb », the acquisition loop is now in an asm-inline code which should prevent different code optimization by different compiler versions. Those problems were submitted by Iosif in the comments, many thanks to him. Here is the new code.

After some tests + optimizations , here is the result : 2421Mhz sampling, 8 channels (port PE8-15).

(Lire la suite…)

Easy/Small JPEG compressor program for embedded systems / mono images

11/20/2012 Posted by admin

Here is a code I created long time ago for PPC target (there is still some asm statements that might work, although I have not tested them recently).

It should be pretty simple to re-use it on any other target that can do 16×16 multiplications.

The main loop looks like this :

For each group of 8x8 block(MCU)
process MCU
write outputbuffer

Code is around 15K in standard C, and results in a static executable file of around the same size (14440 on my machine).

In the example, the input file is ‘image.y’ (Netpbm PGM « rawbits » image data , 1280×1024).
Output file is ‘testout.jpg’.

The jpeg header & related quantification tables are all fixed and pre-calculated (in included files).
(Lire la suite…)

MP3 Audio Decoder on STM32F4 Discovery (updated 30/10/2012) – ChibiOS 2.4.2

09/23/2012 Posted by admin

I like the work that was done by Marco W. (watz) on that forum.

Using the same hardware (SD Card connected to PA5/6/7 and PC4), ChibiOS 2.4.x and LibMAD (instead of Helix),
I finally have managed to get some output…

Most of the code comes from Marco W. ‘s work, I only tried to replace the stm32 audio discovery code by
functions provided by chibiOS (for I2C / I2S via SPI code and DMA).

Here is the code (you need to have ChibiOS sources too).

Update 23/09/2012 : Thanks to a comment by Deanrock, I have repackaged the source code with the I2C
modification & I have tested recompilation using a current Sourcery Code Bench (gcc version 4.6.3 – Sourcery CodeBench Lite 2012.03-56) and Chibios 2.4.2 (this version does not require any patching, just deflate fatfs from the ‘ext’ folder).

Here is the New code

Update 30/10/2012 : with my first tests, I had to enable the chibiOS debugs to get a stable behaviour. It looks like it is running just fine without, provided that -O2 is used (instead of -Os) and that CORTEX_USE_FPU is set to FALSE.

User button is used to skip to the next file.
This one was only tested with Chibios 2.4.2.

Here is the New code

DS18B20 / 1-wire via Little Wire (USB) / OpenWrt on TL-WR841ND

09/15/2012 Posted by admin

I wanted to interface something to my WR841, without too much hassle.
But also some cheap way to do so, to keep advantages of the WR841 price…

Luckly, I already had an AVR-USB based platform, based on ‘Little Wire’ : http://littlewire.cc/

With its latest v1.1 firmware, 1-Wire is available via the Little Wire : that’s my perfect candidate to
add a DS18B20 and to make some temperature measures.

I have quickly cross-compiled the onewire.c example given in the C computer interfacing sources
(Openwrt buildroot, linking the source with libusb-0.1.12) and here is the result :


root@OpenWrt:~# cat /etc/openwrt_release
DISTRIB_ID="OpenWrt"
DISTRIB_RELEASE="Bleeding Edge"
DISTRIB_REVISION="r33276"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
DISTRIB_DESCRIPTION="OpenWrt Attitude Adjustment r33276"
root@OpenWrt:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 003: ID 1781:0c9f Multiple Vendors USBtiny
Bus 001 Device 004: ID 1e3d:8246
root@OpenWrt:~# /root/onewire
> Little Wire firmware version: 1.1
> Address search ...
> Addr#0: 28 4F 4F 7E 2 0 0 3B
> End of search with 1 device(s) found
> Start the talking with the last device found
> 64 1 4B 46 7F FF C 10 1
> 63 1 4B 46 7F FF D 10 15
> 63 1 4B 46 7F FF D 10 15
> 64 1 4B 46 7F FF C 10 1

 

Update 20/03/2013 :

Created an OpenWrt source package and an ipkg (not tested)

Adding USB to my TL-WR841N (v7.2)

07/18/2012 Posted by admin

This could be a pretty cheap way to get :
- Wireless & Wired network
- CPU performance
- USB 2.0
- I/Os (? still to be tested)

I found that WR841N for 23 euros…

Hack to add USB was found here : DD-WRT Forum
(Adding the serial connector is not even worth mentioning – too easy)
(Lire la suite…)

Opening my old WRT54GCv3

04/19/2012 Posted by admin

It was no more used, thus it was time to open it…

Jumper JP2, 1->RX, 2->3.3v, 3->TX, 4->GND

JP1 may be a JTAG connector (12 pins).

The device has a BCM5354, 2MB Flash (serial), 8MB SDRAM.
(Lire la suite…)

MP3 Audio Decoder on STM32F4 Discovery (update)

03/15/2012 Posted by admin

I have made small updates to the code :

- Using -Os instead of -O3 gives much better performance (load is <20%)
- Used 'ssat' instruction for clipping output instead of the basic 'minimad.c' code example.

New code/Binary is here .

MP3 in : lg 879457
...
Decoding return 0
Timing Max. 518 19.82 %
Timing Min. 437 16.72 %
Timing Moy. 466 17.83 %

MP3 Audio Decoder on STM32F4 Discovery

03/07/2012 Posted by admin

The ST Firmware for STM32F4 Discovery includes a simple Audio demo that
demonstrates a Wave player (directory Project/Audio_playback_and_record).

From that project, I derived an Audio_playback_MP3 that plays an embedded MP3
stream (the same audio as in the ST example), but the audio is now around 55 seconds
instead of the original 5 seconds.

The MP3 decoder lib used is the libmad v. 0.15.1 .
(Lire la suite…)

Hack a USB Reader/adapter to use Cheap SDCard DIY Connector

12/18/2011 Posted by admin

Or how-to add a SIL support to a USB Reader/adapter for breadboard modified SDCards :

I really like the idea that I found somewhere (found it back here) of using a single pin header to connect MMC/SdCard to breadboards

Then using it on a breadboard is easy and convenient

 

But it is no more usable on the USB card reader/adapter … Unless you are hacking the adapter too !

(Lire la suite…)