[Hackrf-dev] Air relay ADS-B to BTLE: How to add UART LCD and build

Jiao Xianjun putaoshu at gmail.com
Tue Sep 1 14:44:23 EDT 2015


Hi,

I am planing to open my firmware in several steps. Here is the first step.

(See detailed introduction here: http://sdr-x.github.io/UART1602LCD/ )

When modifying firmware of HACKRF, debugging method is important. Actually
you may add 1602LCD module and UART to hackrf board without changing
anything of the board itself. Here are introduction and demo.
1. Hardware connection

You should have 1602 LCD module and/or USB-UART dongle in your hand. The
two things are very popular, you may google their information easily.

1602LCD HACKRF pin connection:

  HACKRF P20 20 -- 1602LCD pin11
  HACKRF P20 18 -- 1602LCD pin12
  HACKRF P20 16 -- 1602LCD pin13
  HACKRF P20 14 -- 1602LCD pin14
  HACKRF P20 11 -- 1602LCD pin6
  HACKRF P20  9 -- 1602LCD pin5
  HACKRF P20  7 -- 1602LCD pin4
  HACKRF    VCC -- 1602LCD pin2 pin15
  HACKRF    GND -- 1602LCD pin1 pin3 pin16

UART HACKRF pin connection:

  HACKRF P25 1 GND        -- GND of computer or USB-uart dongle
  HACKRF P25 4 UART0 RXD  -- TXD of computer or USB-uart dongle
  HACKRF P25 5 UART0 TXD  -- RXD of computer or USB-uart dongle

For HACKRF P20 and P25 location and definition, you can refer to
hackrf-one-assembly.pdf
<https://github.com/sdr-x/sdr-x.github.io/blob/master/_resource/hackrf-one-assembly.pdf>
and hackrf-one-schematic.pdf
<https://github.com/sdr-x/sdr-x.github.io/blob/master/_resource/hackrf-one-schematic.pdf>
in original HACKRF github repo <https://github.com/mossmann/hackrf>.

Photo of my 1602 LCD module connection
<http://sdr-x.github.io/media/hackrf_one_1602LCD.JPG>

Photo of my USB-UART dongle connection
<http://sdr-x.github.io/media/hackrf_one_UART.JPG>
2. Code example and demo

After some struggling in dark, I finally can present you quite simple code
to output information via UART or 1602 LCD screen.

All you need are two files: CMakeLists.txt
<https://github.com/sdr-x/sdr-x.github.io/blob/master/_resource/CMakeLists.txt>
and hackrf_uart_1602lcd.c
<https://github.com/sdr-x/sdr-x.github.io/blob/master/_resource/hackrf_uart_1602lcd.c>

Put them in a new created directory hackrf_uart_1602lcd
<https://github.com/JiaoXianjun/hackrf-UART-1602LCD/tree/master/firmware/hackrf_uart_1602lcd>
in firmware directory of original hackrf github repo, and build the
hackrf_uart_1602lcd project (See part 3 for build method).

I already put a workable code example here: hackrf-UART-1602LCD
<https://github.com/JiaoXianjun/hackrf-UART-1602LCD>

A firmware hackrf_uart_1602lcd.dfu
<https://github.com/JiaoXianjun/hackrf-UART-1602LCD/blob/master/firmware/hackrf_uart_1602lcd/build/hackrf_uart_1602lcd.dfu>
is also put into firmware/hackrf_uart_1602lcd/build/
<https://github.com/JiaoXianjun/hackrf-UART-1602LCD/tree/master/firmware/hackrf_uart_1602lcd/build>
of above repo <https://github.com/JiaoXianjun/hackrf-UART-1602LCD> in case
someone want to try it in RAM via DFU mode without building firmware.

Here is a demo photo of the firmware running
<http://sdr-x.github.io/media/hackrf_uart_1602lcd.JPG>
3. Build firmware of above code by yourself

Basically you can follow instructions in README
<https://github.com/mossmann/hackrf/blob/master/firmware/README> of
firmware directory in original HACKRF github repo
<https://github.com/mossmann/hackrf> to build firmware. For example:

  cd firmware/hackrf_uart_1602lcd
  mkdir build
  cd build
  cmake .. -DRUN_FROM=RAM
  make
  dfu-util --device 1fc9:000c --alt 0 --download hackrf_uart_1602lcd.dfu
  (before dfu-util, make sure set your board into DFU mode)

But somehow I need to do following things to make sure build go smoothly.
If you can't build firmware, maybe you can give it a shot.

remove "-s 0" in the line of hackrf-common.cmake: (here is a
hackrf-common.cmake
<https://github.com/JiaoXianjun/hackrf-UART-1602LCD/blob/master/firmware/hackrf-common.cmake>
which is already modified)

  COMMAND dfu-suffix --vid=0x1fc9 --pid=0x000c --did=0x0 -s 0 -a _tmp.dfu

add "COMMAND dfu-prefix -s 0 -a _tmp.dfu" after above line in
hackrf-common.cmake.

Maybe you need to install this: git://gitorious.org/dfu-util/dfu-util.git
(I already put one here dfu-util.tar.gz
<https://github.com/sdr-x/sdr-x.github.io/blob/master/_resource/dfu-util.tar.gz>
)

Maybe you need this: sudo apt-get install python-yaml

sudo apt-get install gcc-arm-none-eabi -- *This compiler NOT WORK!!!*

*USE THIS compiler!!!* -->
https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
<https://launchpad.net/%7Eterry.guo/+archive/ubuntu/gcc-arm-embedded>

!!! If you are using Ubuntu 14.04 and later, please be careful because
there are packages with same name but produced by Debian and inherited by
Ubuntu. Simply follow the above 3 steps, you may end up with
gcc-arm-none-eabi from Ubuntu. So to install gcc-arm-none-eabi from ARM,
steps are:

  1). sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
  2). sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
  3). sudo apt-get update
  4). sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q1-0trusty13
      or
      sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q1-0utopic14

If you encounter some command not found error, maybe you need:

  cd /usr/lib/arm-none-eabi
  sudo ln -s /usr/arm-none-eabi/bin bin


<http://sdr-x.github.io/media/hackrf_uart_1602lcd.JPG>


On Sun, Jul 12, 2015 at 10:03 AM, Michael Ossmann <mike at ossmann.com> wrote:

> On Sun, Jul 12, 2015 at 01:00:53AM +0000, Jason Cooper wrote:
> >
> > I should clarify:  I know about the various AIS SDR implementations
> > out there.  I'm interested in running code on the hackrf with just a
> > battery pack.  UI being my $mobile_device.
>
> That's why I mentioned the PortaPack implementation.  It runs on the
> ARM.
>
> Mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist9.pair.net/pipermail/hackrf-dev/attachments/20150902/b3426a04/attachment.html>


More information about the HackRF-dev mailing list