660 Commits

Author SHA1 Message Date
Michael Ossmann
b026c07000 firmware: fix duration of delay_us_at_mhz() 2022-09-26 16:43:43 -04:00
Michael Ossmann
06b9d7bee0 Clean up source code copyright notices. 2022-09-23 14:46:52 -04:00
Martin Ling
3dd2e51d71 Initialise rf_path->switchctrl to SWITCHCTRL_SAFE.
This was previously never being initialised.
2022-09-21 12:22:58 +01:00
Martin Ling
cf34beebb0 Remove extra call to switchctrl_set and global switchctrl variable.
This call is not required since the GPIOs are already configured in
rf_path_pin_setup(). The global switchctrl is not used anywhere else.
2022-09-21 12:17:18 +01:00
Martin Ling
eec6963759 Initialise RF path GPIOs to safe settings.
Previously these calls were leaving the amplifiers on, since the
control settings passed were missing SWITCHCTRL_NO_TX_AMP_PWR and
SWITCHCTRL_NO_RX_AMP_PWR. Use the predefined SWITCHCTRL_SAFE here.

Also move these calls before setting the GPIO pins to output mode,
to avoid driving them to the wrong states briefly first.
2022-09-21 12:05:17 +01:00
Martin Ling
44511c6c3b Move RFFC5072 setup before enabling RF power. 2022-09-19 13:02:29 +01:00
Martin Ling
5d78302d97 Change default RFFC5072 register settings to disable antenna bias. 2022-09-19 13:02:01 +01:00
Martin Ling
6d57709000 Move delay after enabling RF power to rad1o-specific code. 2022-09-19 10:46:01 +01:00
Michael Ossmann
75e3137d55 Merge pull request #1155 from greatscottgadgets/platform-detect
Detect hardware platform at run-time.
2022-09-14 17:45:58 -04:00
Michael Ossmann
9329c5e44e Detect hardware platform at run-time.
Firmware now detects the hardware it is running on at startup and
refuses to run if it is compiled for the wrong platform. The board ID
returned by firmware to the host is now derived from run-time detection
rather than a compile-time value. A separate method to retrieve
compile-time supported platform is added.

On HackRF One, pin straps are checked to determine hardware revision.
This is informational to aid troubleshooting and does not affect any
function.
2022-09-14 07:08:47 -04:00
Michael Ossmann
2104291594 firmware: use consistent clock source
CLKOUT now switches to the active clock source whenever the internal
clocks change source. It previously did so only when (re)enabled.
2022-09-10 06:54:51 -04:00
grvvy
5d7b203058 operacake: disable the usage of time mode when a portapack is installed 2022-09-01 14:03:18 -06:00
Martin Ling
c0d13de598 Add braces to all control statements without them. 2022-08-03 23:46:46 +01:00
Martin Ling
55bea828ea Add missing stdbool.h include to rom_iap.h.
Fixes a clang-tidy error.
2022-08-03 23:46:46 +01:00
Martin Ling
c3fdf402d7 Reformat all code to new clang-format standard. 2022-08-03 23:46:44 +01:00
Martin Ling
ebb9e43fde Move some trailing comments on long lines. 2022-08-03 23:42:55 +01:00
Martin Ling
b50aeb4082 fixup clang-format off 2022-08-03 23:34:28 +01:00
Martin Ling
dbcc46d221 Mark code sections to be left alone by clang-format. 2022-08-03 23:03:15 +01:00
Martin Ling
b4c828915a Use an empty block for empty while loops. 2022-08-03 23:03:15 +01:00
Martin Ling
6cd9ca9483 sgpio: Clean up comments. 2022-08-03 23:03:15 +01:00
Martin Ling
51b76d33a6 sgpio: Remove a redundant variable. 2022-08-03 23:03:15 +01:00
Martin Ling
efd5603c80 Reformat sct.h to avoid long lines. 2022-08-03 23:03:15 +01:00
Martin Ling
a66492b8b7 rom_iap: Clean up comments and realign with spaces. 2022-08-03 23:03:15 +01:00
Martin Ling
1acc71bebf rf_path: Realign scu_pinmux calls. 2022-08-03 23:03:15 +01:00
Martin Ling
6b5193198b Realign GPIO assignments with spaces rather than tabs. 2022-08-03 23:03:15 +01:00
Martin Ling
405515d5b4 Implement NXP's recommended setup sequence for the PLL and M4 clock.
This follows the sequence described in:

UM10503 Rev 2.4 (Aug 2018), section 13.2.1.1, page 167
2022-06-13 16:49:45 +01:00
Martin Ling
273e6a1217 Add an accurate delay loop.
The existing 'delay' function is not calibrated to any specific measure
of time. Add a new function using a loop with a known cycle count, to
produce delays of a given duration at a given CPU clock speed.
2022-06-13 16:32:55 +01:00
Martin Ling
077095451a Schedule ACK after CLEAR_FEATURE / ENDPOINT_HALT request. 2022-03-30 00:34:32 +01:00
Martin Ling
2fba08cf42 Reset endpoint specified in request, not the one it arrived on. 2022-03-29 23:40:08 +01:00
Martin Ling
84898a0bcb Implement USB CLEAR_FEATURE request for ENDPOINT_HALT.
From USB 2.0, section 9.4.5:

"For endpoints using data toggle, regardless of whether an endpoint has
the Halt feature set, a ClearFeature(ENDPOINT_HALT) request always
results in the data toggle being reinitialized to DATA0."
2022-03-29 14:11:00 +01:00
Michael Ossmann
51f1066a2f Merge pull request #1040 from gozu42/clkout
keep clkout state over general clock reconfiguration
2022-02-08 08:41:11 -07:00
Michael Ossmann
2c64f05ec9 Merge pull request #1034 from schneider42/rad1o-ui-cleanup
rad1o UI support
2022-02-07 23:25:01 -07:00
gozu42
4d0ea285b1 keep clkout state over general clock reconfiguration 2022-01-26 18:36:09 +01:00
Mike Walters
8660e44575 Merge pull request #1018 from greatscottgadgets/oc-bugs
Fix Opera Cake bugs
2022-01-12 17:37:58 +00:00
schneider
8a013172b2 rad1o: apply Linux kernel style clang-format 2022-01-10 23:42:52 +01:00
schneider
7bf55dc983 rad1o: Don't update the UI during sweeps
Updating the UI during sweeps significantly increases the time needed to
complete a sweep. Instead simply show "SWEEP" on the display.
2022-01-10 23:26:19 +01:00
schneider
9404226c6a rad1o: UI code cleanup 2022-01-10 23:26:19 +01:00
schneider
0c514839ca hack: add rad1o ui code 2022-01-09 23:27:00 +01:00
Martin Ling
5b2a390728 Move M0 offset and tx variables into a state struct.
These variables are already placed together; this commit just groups
them into a struct and declares this in a new header.

This commit should not result in any change to the firmware binary.
Only the names of symbols are changed.
2022-01-03 18:47:58 +00:00
Michael Ossmann
8cd5d682b8 default to the last specified frequency range
This was supposed to be the default, but there was a bug that looked
past the last range.
2021-12-12 13:29:25 -07:00
Michael Ossmann
d0c0270b9c clear frequency ranges before adding new ones 2021-12-12 13:25:44 -07:00
Michael Ossmann
66de65e6b4 start Opera Cake frequency mode correctly
When switching to frequency mode or modifying the frequency ranges,
ensure that the Opera Cake is switched to the correct port on the very
next tuning.
2021-12-12 13:18:29 -07:00
Michael Ossmann
e25096b17a firmware: add operacake_activate_ports()
Fixes frequency mode which had been broken by operacake_set_ports() only
activating the selected ports when in manual mode (at my suggestion).
2021-12-12 11:56:57 -07:00
Michael Ossmann
083f502413 mirror Opera Cake port selection in frequency mode 2021-12-11 17:51:51 -07:00
Andreas Gibhardt
fc8b3c18d6 fix stream glitch on rate change 2021-12-02 16:27:43 +01:00
Michael Ossmann
bd4b786136 Merge pull request #990 from miek/fix_m0_rebuild
Fix automatic rebuilding of M0 code
2021-11-11 17:03:12 -07:00
Michael Ossmann
74fb86f8bc Do not set USB device address to zero (#987)
When setting the USB configuration to zero  return from the
configured state to the address state according to the USB
specification.
2021-11-10 11:22:08 -05:00
Mike Walters
6d56217762 Fix automatic rebuilding of M0 code
This uses `add_custom_command` to run a cmake script instead of using
`configure_file` directly, which allows for adding dependencies and
creates an ouput that can be depended on.

It also uses `add_custom_command` instead of `add_custom_target` to
create the M0 binary, since custom targets have no output file to depend
on.

Unfortunately, multiple targets cannot depend on the same generated file
or cmake tries to run the generation multiple times in parallel. So, the
.bin/.s generation is now duplicated for each target so they don't
conflict.

fixes #693
2021-11-10 11:31:42 +00:00
Linar Yusupov
909c0ca17f sgpio_cpld_stream_rx_set_decimation() is no longer available 2021-11-08 16:45:11 +03:00
Mike Walters
c50ebb1a36 operacake: add time switching mode 2021-10-14 14:41:52 +01:00