Commit Graph

276 Commits

Author SHA1 Message Date
Jared Boone
060da5d227 Add ChannelDecimator decimate by 2 and no-shift options. 2015-11-19 12:24:20 -08:00
Jared Boone
ccd64f3cd9 Add function for c8->c16 decimate by two without fs/4 shift. 2015-11-19 12:20:20 -08:00
Jared Boone
8967f0eaa1 Move common matchers to PacketBuilder. 2015-11-16 10:33:50 -08:00
Jared Boone
1770dff522 Finish object-izing Baseband and RSSI threads. 2015-11-11 10:54:36 -08:00
Jared Boone
d9106b6f44 Start object-ization of RSSI thread. 2015-11-11 10:11:37 -08:00
Jared Boone
19c89def75 Start to object-ize the baseband thread function. 2015-11-11 10:02:06 -08:00
Jared Boone
2c64454172 More constructor style clean-up. 2015-11-11 09:35:28 -08:00
Jared Boone
d02698a6de Apparent bug where min/max aren't initialized from value inside the buffer bounds.
The fix is less than ideal, it assumes that an incoming buffer length is always >= 1.
2015-11-11 09:30:15 -08:00
Jared Boone
ebf103363c Constructor style clean-up. 2015-11-11 09:16:20 -08:00
Jared Boone
9f6c495fef Add TPMS initial demodulator implementation.
Right now, 2FSK, 19200 baud, +/-38400Hz deviation. No effort is made to check CRC/checksums or decode packets.
2015-11-10 15:19:56 -08:00
Jared Boone
6cdef7026d Remove spectrum window-presum due to lack of code RAM. 2015-11-10 15:16:27 -08:00
Jared Boone
99871dcb84 Move a few member variables to stack/constants. 2015-11-10 15:10:52 -08:00
Jared Boone
981c2fbfbd Complete FSKProcessor's trip to being AISProcessor. 2015-11-10 15:04:38 -08:00
Jared Boone
111a5f10c0 Add some baseband constructors.
Some of them I think I took out earlier...
2015-11-10 14:04:50 -08:00
Jared Boone
add6171410 Move BasebandStatistics from heap to stack. 2015-11-10 13:59:17 -08:00
Jared Boone
0789d50fdf Rework BitHistory, BitPattern, PacketBuilder.
Templatize PacketBuilder to optionally bit unstuff, and have flexible packet termination behavior.
2015-11-09 14:38:09 -08:00
Jared Boone
5dcca89172 FSKProcessor: remove separate channel filter.
RRC filter alone will do the trick!
2015-11-07 14:10:44 -08:00
Jared Boone
fc037c739a Comment about correct MatchedFilter usage.
Because the filter expects a combined translate/rotate and low-pass filter in the taps, the taps must be a multiple of the translate sinusoid period.
2015-11-07 11:27:31 -08:00
Jared Boone
ae225e8c3b Further MatchedFilter optimization using algebraic identities and stuff.
Can't stop premature optimization!!!
2015-11-06 09:40:05 -08:00
Jared Boone
100761481e Fix inaccurate comment. 2015-11-06 09:40:05 -08:00
Jared Boone
3d5c8056d9 Premature optimization of MatchedFilter::shift_by_decimation_factor(). 2015-11-06 09:40:05 -08:00
Jared Boone
4afcc83873 Mark MatchedFilter::is_new_decimation_cycle() as const. 2015-11-06 09:40:05 -08:00
Jared Boone
3c33e20156 Rename MatchedFilter::decimation_factor. 2015-11-06 09:40:05 -08:00
Jared Boone
7a59823211 Stop computing channel spectrum during FSK demod.
Data is unused, as screen is displaying decoded packets.
2015-11-06 09:40:05 -08:00
Jared Boone
ddd34793a6 Default constructors and configure methods for baseband classes. 2015-11-06 09:40:05 -08:00
Jared Boone
51df92a05a Rename baseband_ais -> ais_baseband.
So that ais_baseband and ais_application filenames can be sorted near each other.
2015-11-06 09:40:04 -08:00
Jared Boone
26c23dc8a0 Use new FIR decimation in FSK demodulator.
Reduces FIR calculation effort when output samples are skipped at FIR filter, not after.
2015-11-06 09:40:04 -08:00
Jared Boone
86b068be62 Early calculation to reduce pressure on registers. 2015-11-06 09:40:04 -08:00
Jared Boone
a074e7d8d8 Remove commented code. 2015-11-06 09:40:04 -08:00
Jared Boone
424c0eac3f FIRAndDecimateBy2Complex: expose decimation_factor, bring work function into class. 2015-11-06 09:40:04 -08:00
Jared Boone
cde15e4271 Generalize fir_and_decimate_by_2_complex_fast.
Permit decimation_factors other than 2.
Permit tap counts != 64 (but still must be multiple of 8).
Half the amount of tap memory required.
Performance is significantly degraded due to greater flexibility -- most likely due to separate sample buffer shift phase, instead of performing shift during output sample calculation.
2015-11-06 09:40:04 -08:00
Jared Boone
be78ed657f Remove taps_count template arg for FIRAndDecimateBy2Complex.
Use heap to allocate samples and taps buffers, so filters of different lengths can be supported.
2015-11-06 09:40:04 -08:00
Jared Boone
0f73d6061a Remove old decimating FIR code. 2015-11-06 09:40:04 -08:00
Jared Boone
015e5516d5 Update/consolidate AIS RRC matched filter taps. 2015-11-06 09:40:04 -08:00
Jared Boone
dab801e167 AIS RX tweak of clock recovery constant for better performance. 2015-11-06 09:40:03 -08:00
Jared Boone
58b97dea68 AIS RX performance improved with 32-tap RRC. 2015-11-06 09:40:03 -08:00
Jared Boone
f82fd1f8d7 Tease apart utility.hpp, other header dependencies.
Trying to get a host-testable FSK demodulator, and finding a lot of M4- and ChibiOS-specific code is getting included. Boo.
2015-11-06 09:40:03 -08:00
Jared Boone
e049097f49 Remove spurious commented code. 2015-11-06 09:40:03 -08:00
Jared Boone
4aae77f565 MatchedFilter improvements
Use single set of taps for positive and negative filters.
Reverse taps (since new samples are pushed into buffer from the high end).
Make complex multiply explicit to avoid fancy but irrelevant arithmetic checks.
Compute negative filter from conjugation of positive filter taps.
Move filter power and difference calculations into MatchedFilter.
2015-11-06 09:40:03 -08:00
Jared Boone
ab28639a3d Use std::move to move samples in buffer.
Yes, std::rotate works, but it's fancy and does unnecessary work.
2015-11-06 09:40:02 -08:00
Jared Boone
4141d6fe0f Untemplate MatchedFilter, a different way. 2015-11-06 09:40:02 -08:00
Jared Boone
fe94cfa45a De-std::vector MatchedFilter, was chewing up far too much memory. 2015-11-06 09:40:02 -08:00
Jared Boone
64ed539554 Change LinearResampler.advance to external use only. 2015-11-06 09:40:02 -08:00
Jared Boone
4ed385d15e Prioritize PacketBuilder found_end_flag() over packet_truncated(). 2015-11-06 09:40:02 -08:00
Jared Boone
c2e7f9a6f4 Shorten AIS training sequence match length. 2015-11-06 09:40:02 -08:00
Jared Boone
d92c962c0c Set MatchedFilter taps with separate method. 2015-11-06 09:40:02 -08:00
Jared Boone
8198db768d Move some MatchedFilter code to .cpp file. 2015-11-06 09:40:02 -08:00
Jared Boone
aff7865c61 Move (some) AIS bits to a separate file. 2015-11-06 09:40:02 -08:00
Jared Boone
7a5100baf1 Enlarge packet payload size 256 -> 1024 bits. 2015-11-06 09:40:01 -08:00
Jared Boone
68250b4d30 Expose weight() of FixedErrorFilter. 2015-11-06 09:40:01 -08:00
Jared Boone
474eaa8541 Template ClockRecovery for ErrorFilter type. 2015-11-06 09:40:01 -08:00
Jared Boone
9879af37d5 FixedErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
727d4c8a1f Const the FixedErrorFilter operator(). 2015-11-06 09:40:01 -08:00
Jared Boone
93b9b9d9ef LinearErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
37b1d7cf2f Remove payload_length from PacketBuilder, etc. 2015-11-06 09:40:01 -08:00
Jared Boone
cf3bff3b03 Decouple PacketBuilder PayloadHandler function from method type. 2015-11-06 09:40:01 -08:00
Jared Boone
1bdad62496 Simplify PacketBuilder pattern matching and symbol accumulation. 2015-11-06 09:40:00 -08:00
Jared Boone
36689f5c45 Refactor bit pattern matching.
Remove AccessCodeCorrelator, Unstuff classes.
2015-11-06 09:40:00 -08:00
Jared Boone
f918a774b7 Address implicit cast compiler warnings. 2015-11-06 09:40:00 -08:00
Jared Boone
0bc8f551de Use matched filter for AIS GMSK demodulation demo.
Less than optimal for plain FSK, but flexible enough to also support GFSK/GMSK. Not at all optimized for SIMD instructions, so may not perform adequately at Bluetooth/GSM rates.
2015-11-06 09:40:00 -08:00
Jared Boone
a9c190b6bb Matched filter implementation.
Essentially a complex FIR filter that's more flexible than the ones already in the code base. Refactor?!
2015-11-06 09:40:00 -08:00
Jared Boone
e9f28f9ef3 Provide configuration of symbol unstuffing. 2015-11-06 09:40:00 -08:00
Jared Boone
a00fcbaa8f Unstuffing pattern length of zero should never match. 2015-11-06 09:40:00 -08:00
Jared Boone
05badaddda Put symbol coding into PacketBuilder.
Removes stuffing symbols before placing them into packet buffer.
2015-11-06 09:40:00 -08:00
Jared Boone
c936e09702 Add bit unstuffing algorithm.
For use in AIS. Probably useful elsewhere, too...
2015-11-06 09:39:59 -08:00
Jared Boone
31ff13f1c0 Un-const Message in message handler interfaces.
I want to modify in place the messages that are received. Naughty, but oh well.
2015-11-06 09:39:59 -08:00
Jared Boone
5c31e803c8 Change interface to AccessCodeCorrelator, inline in header. 2015-11-06 09:39:59 -08:00
Jared Boone
a3cce5632e Complete rewrite of clock recovery, lots of refactoring. 2015-11-06 09:39:59 -08:00
Jared Boone
8b2e75a299 Add LinearResampler implementation for clock recovery. 2015-11-06 09:39:59 -08:00
Jared Boone
f13e2d32c0 Add symbol coding namespace, NRZI decoder. 2015-11-06 09:39:59 -08:00
Jared Boone
934936d3f6 Enhancements to clock recovery
Linearly interpolate input and delayed samples, based on phase of internal symbol clock.
2015-11-06 09:39:59 -08:00
Jared Boone
291de8f869 Change channel_spectrum type to std::complex<float>.
Move FFT bit-reversal to complex<int16_t> -> complex<float> copy.
Change window so that adjacent bins have constant(-ish) gain.
Change window to float.
Change time domain samples to accumulate at even intervals over the FFT interval.
2015-10-14 11:10:24 -07:00
Jared Boone
7f46f0d071 Add tick tracking for all baseband threads. 2015-10-14 10:44:20 -07:00
Jared Boone
e2bb77d756 Change wideband FFT bin filter, clean up code a bit. 2015-09-02 11:29:38 -07:00
Jared Boone
c4de9c4423 Mute audio whenever baseband mode is changed. 2015-09-01 21:05:47 -07:00
Jared Boone
c52de7abe6 Clean up baseband/RSSI streaming control.
Address hang-up of baseband and RSSI when switching modulation modes really fast.
2015-09-01 21:05:32 -07:00
Jared Boone
5d8c636f40 Halt M4 right after sending M0 the shutdown message.
Addresses issue #55.
2015-09-01 13:49:09 -07:00
Jared Boone
3fea68d777 Adjust wideband specan gain to match other modes. 2015-08-27 14:57:05 -07:00
Jared Boone
b13081696d Simplify MessageQueue pop() usage. 2015-08-27 14:35:17 -07:00
Jared Boone
d8b3b4cb6b Check queue empty only once when reading messages.
There was a second is_empty() call hidden in the pop() call, so the while(condition) was redundant.
2015-08-27 14:27:29 -07:00
Jared Boone
e751e10e45 Add wideband spectrum processor. 2015-08-27 13:57:31 -07:00
Jared Boone
23ac04ad56 Make channel spectrum members protected, not private. 2015-08-27 13:51:55 -07:00
Jared Boone
c7907e948c Extract FSKProcessor into separate files. 2015-08-27 13:31:39 -07:00
Jared Boone
ffe829cf67 Extract WidebandFMAudio into separate files. 2015-08-27 13:19:34 -07:00
Jared Boone
7c5db55f8f Extract NarrowbandFMAudio into separate files. 2015-08-27 13:14:45 -07:00
Jared Boone
e246ea2c39 Extract NarrowbandAMAudio class into separate files. 2015-08-27 13:07:07 -07:00
Jared Boone
6bf61cbe88 Extract BasebandProcessor into separate files. 2015-08-27 11:11:08 -07:00
Jared Boone
b0e9afe26c Add missing #includes. 2015-08-27 11:10:44 -07:00
Jared Boone
04d05368c7 Push static variables and spectrum calc into BasebandProcessor. 2015-08-27 10:48:29 -07:00
Jared Boone
de0777f476 Extract FMSquelch into separate files. 2015-08-27 09:59:03 -07:00
Jared Boone
b904971ef2 Extract IIR filter configurations into separate file. 2015-08-27 09:58:37 -07:00
Jared Boone
c92bf12fbd Extract ChannelDecimator into separate files. 2015-08-27 09:49:14 -07:00
Jared Boone
98773cb62a Make GIT_REVISION value available within code.
Addresses issue #59.
No idea what it'll do if the commit is also tagged as a release...
2015-08-25 16:33:52 -07:00
Jared Boone
3a96c04aa7 Implement, use configuration for FM demod deviation. 2015-08-21 09:19:08 -07:00
Jared Boone
fa275156ed Move FSKPacketMessage to stack. 2015-08-21 09:18:21 -07:00
Jared Boone
589cb47cc6 Move M4 shutdown() next to init(). 2015-08-20 20:40:46 -07:00
Jared Boone
672284080b Extract M4 IPC IRQ code into separate file. 2015-08-20 20:39:08 -07:00
Jared Boone
690c3c98db Add Shutdown message, plumbing to send and handle. 2015-08-20 18:03:49 -07:00
Jared Boone
15791e345d Make baseband event loop methods private. 2015-08-20 17:57:59 -07:00
Jared Boone
9742a058e9 Move event loop into dispatcher, provide a way to exit. 2015-08-20 17:56:19 -07:00
Jared Boone
4126f1ab1f Change IPC to exchange data, not pointers. 2015-08-20 13:13:12 -07:00
Jared Boone
a7226820d0 Hide implementation of MessageHandlerMap. 2015-08-14 17:31:23 -07:00
Jared Boone
4e0de9c4ad Fix clock configuration for M4.
M0 launches baseband, so M4 clock can be set to PLL1. Provide a way to configure that per project, set to correct values for baseband project.
2015-08-14 12:21:49 -07:00
Jared Boone
66320c39d4 Restore missing halInit() call during M4 __late_init(). 2015-08-14 12:20:45 -07:00
Jared Boone
14ada9e132 Push channel filter data into BasebandProcessor. 2015-08-04 16:48:15 -07:00
Jared Boone
caef87fe90 Refactor IIRBiquadFilter to separate configuration structure. 2015-08-04 15:00:38 -07:00
Jared Boone
76df4f0369 Extract magnitude_squared to utility. 2015-08-04 14:08:15 -07:00
Jared Boone
de0c884b67 Remove test code. 2015-08-04 13:52:04 -07:00
Jared Boone
eea589bd98 Extract stats collectors into separate files. 2015-08-04 12:03:30 -07:00
Jared Boone
efaf13d2d1 Extract complex16_mag_squared_to_dbv_norm to utility. 2015-08-04 12:03:10 -07:00
Jared Boone
ae62405344 Simplify audio muting.
Zero out the audio buffer instead of muting the codec. The HPF (and other downstream signal processing) can continue running, not produce discontinuities from being effectively halted during mute.
2015-07-21 10:33:40 -07:00
Jared Boone
e51db769e6 Refactor to update audio stats when audio output is muted. 2015-07-20 10:21:01 -07:00
Jared Boone
665f54b410 Reorganize BasebandProcessor method/member visibility.
Also hide feed_audio_stats() inside fill_audio_buffer().
2015-07-20 09:41:56 -07:00
Jared Boone
d7cb2c5da4 Simple FM squelch. 2015-07-20 09:34:24 -07:00
Jared Boone
876a591a66 Add IIR execute_in_place() 2015-07-20 09:33:56 -07:00
Jared Boone
71990b380a Bind pass/stop band info to filter taps.
Created fir_taps_real<N> structure, with pass and stop normalized frequencies.
Removed unused filter taps.
2015-07-18 16:50:59 -07:00
Jared Boone
6f2cbd1ac5 Partial refactor of channel filter frequency code.
Move channel filter frequency determination to baseband side, where the filtering is determined and performed.
Add useful accessor methods to BlockDecimator.
2015-07-18 16:49:40 -07:00
Jared Boone
ffc50785b7 specan: cleared up terminology, accounted for decimation.
Channel spectrum decimation now accounted for when computing filter frequencies.
Renamed a bunch of variables relating to channel spectrum bandwidth and filter frequencies.
2015-07-18 16:48:19 -07:00
Jared Boone
98bd9c54e4 Rework how spectrum and filter bandwidth is represented to UI.
Issue #13.
2015-07-18 16:46:59 -07:00
Jared Boone
e571ca7f1c Change reference initializations errors in GCC 4.8
Resolves issue #12.
2015-07-17 12:07:38 -07:00
Jared Boone
92ba4d7fea Fix line endings.
Addresses #21.
2015-07-17 10:55:54 -07:00
Jared Boone
43d13ab47c Mute audio in FSK mode.
Addresses #17.
2015-07-17 10:05:54 -07:00
Jared Boone
7c9fc62f5e Move halt indication code to common place. 2015-07-08 16:28:57 -07:00
Jared Boone
f360c01ff3 Unify duplicated code between touch_adc.cpp and rssi.cpp.
Also remove comments and dead code.
2015-07-08 16:00:18 -07:00
Jared Boone
c142b1bcfc Fix RSSI ADC DMA not working bug.
Resolves sharebrained/portapack-hackrf#3
2015-07-08 15:48:20 -07:00
Jared Boone
dc6fee8370 Initial firmware commit. 2015-07-08 08:39:24 -07:00