Commit Graph

268 Commits

Author SHA1 Message Date
Harald Welte a0df047214 major update of README
* make sure all projects and relevant links are mentioned
* indicate which sub-directories relate to which project
* use markdown syntax

Change-Id: If126790c5652a6228e8a8ad1986e3b08adf46fae
2022-10-31 09:06:35 +01:00
Harald Welte 6e2150ee0c sw/e1tracer: Rename 'main' to 'e1-tracer-record'
Change-Id: If70429e6a0504c657f44f9d0301a128d69ce7c18
2022-10-31 08:38:04 +01:00
Harald Welte 1d062b82c5 sw/e1-tracer: split recorder + analysis tools in sub-directories
this way it's easier to see which part of the code is used where

Change-Id: I7d727263383ec1d6d61dd31fcfebf4a4b1a04765
2022-10-31 08:37:26 +01:00
Harald Welte f5e7264a27 import latest e1-tracer host software
This was originally in https://github.com/smunaut/ice40-playground
but has meanwhile been removed, only a fork at
https://github.com/laf0rge/ice40-playground remained.

Let's import the code here.  The history is not all that exciting
so I'm saving myself the effort of git filter-branch or the like
to import the actual old commits.

The commit log is here for reference:

commit bd36d40cc30acbae68978df79eff03f0539a9a21
Author: Harald Welte <laforge@osmocom.org>
Date:   Fri Sep 4 10:21:51 2020 +0200

    e1-recorder main.c: Don't exist just because one ISO transfer failed

    I get LIBUSB_TRANSFER_ERROR every so often (once every few hours) on my
    laptop.  Sure, it likely means there was some data lost, but the trace
    can continue juts fine after this error.  So make it non-fatal and
    continue running.

commit 9b02b3e87400ba3d27bff05e2632fbd5a0698e8c
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Aug 31 10:01:20 2020 +0200

    Add 'replay' to re-play 2Mbps stream with realistic speed (to stdout)

commit 23103d3a8f9cc8b3f0ba602dbb4240040b2d008a
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Aug 30 15:41:12 2020 +0200

    dump: Use osmo_e1f to decode; send HLDC over GSMTAP

commit 7acd063a1245a34835d4488be3caad592f3c19d5
Author: Harald Welte <laforge@osmocom.org>
Date:   Thu Aug 20 16:48:15 2020 +0200

    dump.c: Add error plotting support

commit 90b90d04fff494b70ad220bd82ac48d43f3096c9
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 18:20:39 2020 +0100

    dump: Add support for writing LAPD PCAP of E1 superchannel

commit f3a0cc34f0901c2cf257367351dddfddc6f7301e
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 16:37:23 2020 +0100

    dump.c: Move handling of frames to separate function

commit 8deffb5907979e43e3a4236ea7bb8d54513513ac
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 16:34:39 2020 +0100

    dump.c: remove local hexdump.[ch] and use libosmocore proper

commit 80d81e78737237ba3b6bae1deb7d5107d7f613b6
Author: Harald Welte <laforge@osmocom.org>
Date:   Tue Sep 1 13:52:52 2020 +0200

    tracer: use 0x6151 as PID

    See 5e68831b26

commit b219af27b34bbd6deb2419aa38852d8d227b9fc0
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 13:47:28 2020 +0100

    e1-recorder: Don't silently ignore write failures

    The disk may be full, for example. We should report that to the user
    and terminate the program.

commit ead99fdfae6f1db54c79a91ef407a86c67352d87
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 12:41:23 2020 +0100

    e1-recorder: Exit process on transfer + resubmit failure

    This is particularly importnat in case the USB device for some reason
    gets disconnected and re-connects.  We want the process to fail fast
    and have systemd respawn us.

commit a521e026c76056a60531c490fa2ef84e8e633c9a
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 12:35:20 2020 +0100

    e1-recorder: use libusb_strerror() to decode error messages

commit 43a8fbdfdc35f5ba7564cfe5c92f43b124abf710
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Jan 5 19:49:58 2020 +0100

    e1-recorder: Acytually make '-r' (SCHED_RR) work

commit 84e28225d9ba1de9fb09660a96bd3b0b798c88d9
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Jan 5 17:53:11 2020 +0100

    e1-recorder: Add small 'dump' program

    This program will print one line for each E1 frame, where each line
    consists of 32 hex bytes: one for each timeslot

commit 0c697b40620b5d18480e626991dc639daadf58a6
Author: Sylvain Munaut <tnt@246tNt.com>
Date:   Sun Dec 29 13:13:17 2019 +0100

    projects/riscv_usb: Host software for the dual channel sniffer

    Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

Closes: OS#5673
Change-Id: I9319c1eb8f822830307c1a181d357c58ce43efba
2022-10-31 08:28:43 +01:00
Sylvain Munaut c756644205 gateware: no_rw_check fixes to cope with new yosys BRAM inferrence
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ic27dc22112f6603982126d447689dbe2202039c4
2022-10-04 21:34:56 +02:00
Sylvain Munaut 9b3f2c4a6b icE1usb fw: Limit dfuprog to proper USB IDs
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iaf96565b4068c2d6aa46d8bedac1fad618130a26
2022-10-04 16:16:20 +02:00
Sylvain Munaut db0b81065c icE1usb fw: Add support for building 1 channel version
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I147bb90fca3cead8db776ecfd60c23b4b8bafe2d
2022-10-04 16:16:20 +02:00
Sylvain Munaut dc1d741797 icE1usb fw: Add Notify PPS on Carrier Detect option
This is disabled by default because turns out the kernel doesn't
actually support PPS on CD for USB-CDC devices :(

And this also increase the interrupt traffic ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie5d163434323a23912228003add9870fafefedf9
2022-10-04 16:16:20 +02:00
Sylvain Munaut da395cc922 icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over mode
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
2022-10-04 14:58:18 +02:00
Sylvain Munaut b8fc8a6a64 icE1usb fw/gpsdo: Use PID loop instead of ad-hoc algo
The original algo is just somehting I originally came up with
on the spot and worked and I never got the time to revisit.

Now after some testing, I implemented a PID loop that seems to
present faster lock time and at least as good stability.

Parameters were not thorougly optimized just some 'hand' tuning
trying to simulate the behavior.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie3ea7243aa4234585f1ace222632bb5580caca75
2022-10-04 14:54:36 +02:00
Sylvain Munaut ad0fc21d61 icE1usb fw/gpsdo: Use a struct for VCTXO dependent params
Not that useful for now, but prep for PID loop

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iffea8992130eccd98a2952b08277e3d0d2568a1f
2022-10-04 14:43:56 +02:00
Sylvain Munaut cfb8b0b7a0 icE1usb fw/gpsdo: Export accumulated error
This is a pretty usefu stat as this is what actually matters

Note that structure is just extended so any call with a wLength
shorter will just get the beginning of the struct (usb stack
limits response to wLength) and thus is fully backward compatible.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I0aa919d4870ca7e1b653b82ac4f76ed26b5e3b08
2022-10-04 13:54:49 +02:00
Sylvain Munaut abf08908dd hardware/icE1usb-rs422: Add missing gitignore
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I836c609d00aa93a453da7cb593ddedc35e288a0c
2022-09-13 10:47:24 +02:00
Sylvain Munaut f73c4268e0 hardware/icE1usb-rs422: Import datasheets for main components
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I38fd4d91ed2956fd3cfd435642e69b0f89831b6f
2022-09-13 10:46:09 +02:00
Sylvain Munaut 3e51deed3f hardware/icE1usb-rs422: Initial import of RS422 extension HW
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie878a1691fb18e288a21e139604b53b11cc95dad
2022-09-13 10:31:44 +02:00
Sylvain Munaut bdc41ffe73 hardware/icE1usb: Update ECNs for future rev 1.1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I699254663564ecbad75394307edc44be0340e4d5
2022-09-05 23:46:29 +02:00
Sylvain Munaut 945028166a hardware/icE1usb: Update silkscreen version
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id852e22b667e1794ca89e1e730b73ecf542c06c4
2022-09-05 23:41:24 +02:00
Sylvain Munaut 529d3c0806 hardware/icE1usb: Add fiducials
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id94a703884725ad5921a5ff9bcd490ea308da6fc
2022-09-05 23:40:22 +02:00
Sylvain Munaut 9f1efa69ab hardware/icE1usb: Add NO jumpers in the GPS I2C lines
Fixes OS#5664

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I7b65d6845b0dee5296096409049dafdc4fed3067
2022-09-05 23:31:07 +02:00
Sylvain Munaut 01a0dbda99 hardware/icE1usb: kicad 6 resync sch/pcb + cleanup
Just the automated resync + the track/via cleanup pass

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I3b5a70fa0673f7ee5d45da2a8ab012db158f6eed
2022-09-05 22:40:44 +02:00
Sylvain Munaut e695046981 hardware/icE1usb: Convert to kicad 6
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6914fe05a149b8e3f4b5fb42cc6416aa15b4d367
2022-09-05 22:29:51 +02:00
Sylvain Munaut 9da5486e00 hardware/icE1usb: Remove panelized version
Further production runs will use another panel setup anyway
and this one is archived in r1.0 anyway.

But this cleans up the way for kicad 6 update

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I864503c1edf28993bc9c4c12842856ab1002870c
2022-09-05 22:29:51 +02:00
Sylvain Munaut 112d858a4d gateware/build: Update submodule
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ib61dac16fc2399b8b357ec8ba8e7f19e2c79b4d8
2022-08-25 17:05:01 +02:00
nickvsnetworking cf587af09e Doc Update - Build process for DAHDI on Debian 11
Change-Id: I0679bd14702b7b3d05c3346ce10358f45fef0301
2022-05-17 11:16:29 +02:00
Sylvain Munaut aae4d3059d firmware: Remove a couple of questionable debug puts()
Those were low level debug meant to be temporary and somehow ended
up committed.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie1b802f347b0de9ea82edb61faaba6094b8f4dfa
2022-05-03 14:00:35 +02:00
Sylvain Munaut 0685eddc1f gateware/icE1usb: Use custom I2C core by default rather than SB_I2C
SB_I2C is apparently just a pain to use and buggy and such, so
use our custom one.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I1596ccbf03dd4450f519fe9b54a7fece125a7fbc
2022-05-03 14:00:35 +02:00
Sylvain Munaut 0c1684e5ae gateware/icE1usb: Set divider of I2C core to be ~ 400 kHz
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I1dd4ab34da9d01b599cf9c782e721aaee9b8740d
2022-05-03 14:00:35 +02:00
Sylvain Munaut 921f4779f5 gateware/icE1usb: Replace local I2C core with no2misc one
This core has been merged (and improved) upstream, so
update the submodule, remove local copy and make the required
tweaks.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I79fca561fee32bbaec94882b4f65c7ecaa44be11
2022-05-03 14:00:35 +02:00
Sylvain Munaut 9e02d4cd99 gateware/icE1usb: Typo in instance names
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I7db544b4ff98fcfc382193f040550f377178aebf
2022-05-03 14:00:35 +02:00
Sylvain Munaut f12087fed3 gateware/icE1usb: Don't let nextpnr promote globals
We manually use global buffers for the signals that need to be
global, don't let nextpnr heuristic mess with things.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5dc5f2f39dca933b2570cbe4e26d9d7fd2a44688
2022-05-03 14:00:35 +02:00
Sylvain Munaut 90ca05dd54 gateware/common: Unify a bit with other repo
This just pulls in some small update in various files shared
by several repository. It's mostly comment and formatting, nothing
functionnal really.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Icb7bea1cf7243e9ace819cd567eb006fcc71c808
2022-05-02 20:45:08 +02:00
Sylvain Munaut b72aba9586 icE1usb fw/gpsdo: Limit the fine tuning range
Fine tuning has a limited tuning range. If at some point we
hit the limits, we need to bit the bullet and try to 'transfer'
some of that to the coarse range as best as we can. Hopefully
we get it close enough to limit disruption.

Note that this should really never happen because although it's
limited, the tuning range should be good enough to absorb any
reasonable temperature / aging variation once we have coarse tuned.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I2d9d348f5466f581b3d6d36c98847c47e2452f98
2022-04-22 10:37:58 +02:00
Sylvain Munaut 8598d48675 icE1usb fw/gpsdo: Attempt to recover from bad tuning
If we're in hold over mode and getting a bunch of invalid
frequency measurement despite a good fix, then we most likely
ended up on a bad tuning value and we need to recover by starting
from scratch.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If8503a3eaf695e02a0ef0a3b6536de985d247c20
2022-04-22 10:35:53 +02:00
Sylvain Munaut 103a83cbdc icE1usb fw/gpsdo: Add debug prints for coarse/fine tune entry
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ife69f9ce4c6f3eb6d40b05ce8f862ff68180357f
2022-04-21 23:28:35 +02:00
Sylvain Munaut 8014c3cd09 icE1usb fw/gpsdo: Never use invalid measurements to feed loop
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I9c7b81c6e2e600ed49ac766fa33df23747dd339e
2022-04-21 23:27:57 +02:00
Sylvain Munaut 28eb5d1b96 icE1usb fw/gpsdo: Fix typo in the condition to exit TUNE_FINE
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6106f07f7bff1c298ac3f86164e155d4bfb1b7ac
2022-04-21 23:26:59 +02:00
Manawyrm 212d6c3576 manual: add info and renders to show to set TE/NT mode
The page break is currently a bit ugly, but I didn't see an easy way
to fix it. The images and info text should make the process much clearer.

Change-Id: I5999dc60850da2cd02d9bbc7db5727cdebf041c6
2022-02-24 10:12:47 +00:00
Harald Welte 4d8e12413f manual: Document the factory default jumper setting
Also re-word/expand a bit on the situations in which NT mode
or cross-over is needed.

Change-Id: Ie726d4ca2e8605015a2f0384d2b435e1b40c1cad
2022-02-23 22:00:09 +01:00
Harald Welte ce1262fc51 manual: fix link to gateware
Change-Id: Iad107b33d182e3d9343dfb4e533360740e9c85df
2022-02-23 21:26:32 +01:00
Harald Welte cac342af6b icE1usb: Move GPS-DO USB control to separate USB interface
doing so significantly simplifies the development of a Linux kernel
driver, as the GPS-DO only exists once (not twice, like the per-E1-line
interface), and Linux kernel USB drivers typically are for an interface.

There is an option to write a usb_device_driver, but doing so will
exclude the per-interface drivers from still being probed in their usual
fashion.

While we introduce this new USB Interface for the GPS-DO, we also
move the related control endpoint requests from the device level to the
interface level.

Finally, some naming inconsistency between "enum
ice1usb_gpsdo_antenna_state" vs. the member name antenna_status is
resolved.

Change-Id: Icd6555a14896c38626fb147b78af44ff719f2254
2022-02-01 17:57:12 +01:00
Harald Welte fddf5990bd icE1usb: Fix ordering of USB interface numbers
The USB spec requires interface numbers to be in sequential order,
and the existing firmware fails that requirement, as is shown by
the Chapter9 test suite ("USB30CV").

With this patch applied, the USB30CV Chapter9 test suite passes.

Change-Id: I6a5434447ee20f77ce0ba9e7b1884cbd5b466439
2022-02-01 17:26:38 +01:00
Harald Welte fdfabf93f5 icE1usb doc: Add pictures of front and back side
Closes: OS#5406
Change-Id: Ifc382c762119b397dd9a6b484ebc9a237897fba9
2022-01-18 20:22:56 +00:00
Harald Welte 4090182ce0 icE1usb doc: Link to wiki page about iso USB issues
Change-Id: Id5f555519d5e320570017178613c752591db4a2f
2022-01-18 20:22:56 +00:00
Oliver Smith d0a5a5d074 checkpatch.conf: new file
Disable spacing and open brace checks, as this repository follows a
different code style.

If needed, the checkpatch file can be extended with other checks:
* get the check name from the linter output, e.g. SPACING in:
  firmware/ice40-riscv/icE1usb/fw_app.c:155: ERROR:SPACING: spaces required around that '=' (ctx:VxV)
* add a new "--ignore NAME" line to the file

Related: https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26841
Related: OS#5399
Change-Id: I4d2cf2eb698b8f4e54f04e62e4dbbc37146daf88
2022-01-17 17:28:16 +00:00
Harald Welte 9df9995d2f icE1usb: update manual to reflect firmware 0.2 (GPS-DO, 2 ports)
Change-Id: I9dac5b9479af37270dc13e334a278f91f260c7ce
2022-01-17 17:16:09 +01:00
Harald Welte 24eb3e308a icE1usb doc: DAHDI driver no longer experimental
Change-Id: I0c65d7be98f514a5f106472389472a177d3c58c2
2022-01-16 18:12:59 +01:00
Harald Welte da526ac8f6 jenkins.sh: Fix upload of tagged releases
Tagged releases get something like icE1usb-fw-0.2.elf without a
git-hash component suffix.  So the old glob *-*-*-*.{bin,elf}
was not matching and we got errors like

rsync: link_stat "/build/firmware/ice40-riscv/icE1usb/*-*-*-*.bin" failed: No such file or directory (2)
rsync: link_stat "/build/firmware/ice40-riscv/icE1usb/*-*-*-*.elf" failed: No such file or directory (2)
Change-Id: I7509f9d92ec19c1702af5f958d495e21321053bc
2022-01-16 18:10:41 +01:00
Sylvain Munaut c308334de7 icE1usb fw: Add USB control for the GPSDO function
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If92aa68d8a49349fa0d6d556eec81bbb80be989c
2022-01-13 13:21:29 +01:00
Sylvain Munaut e76b643298 icE1usb fw: Add GPSDO VCXO trimming loop
Rather basic and not super well tested, use with caution

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5f9ce6621492be967d6a44d31f270e107f3ef686
2022-01-13 13:21:29 +01:00
Sylvain Munaut 70c10f05cf icE1usb fw: Expose the GPS NMEA data as a CDC ACM
Note that this is read-only. We drop all data from the host
because we can't have the host reconfigure the module ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ieb6a653ece882c5f90ab27da1bca04c94184dc5a
2022-01-13 13:21:29 +01:00