AD9857 IQ DDS Digital Up Converter Experiment using Nucleo F401
Digital Signal Processing for IQ Quadradure Modulation DDS AD9857 using Nucleo F401.
see http://ttrftech.tumblr.com/post/114310226891/
dsp.h@6:ed82052bd505, 2015-03-23 (annotated)
- Committer:
- edy555
- Date:
- Mon Mar 23 21:53:48 2015 +0000
- Revision:
- 6:ed82052bd505
- Parent:
- 0:55201637d936
use phase accumration in fm modulation, archive very good result!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
edy555 | 0:55201637d936 | 1 | #ifndef _DSP_H_ |
edy555 | 0:55201637d936 | 2 | #define _DSP_H_ |
edy555 | 0:55201637d936 | 3 | |
edy555 | 0:55201637d936 | 4 | #define HILBERT_TRANSFORM_FIRSTATE_LENGTH 128*2 |
edy555 | 0:55201637d936 | 5 | |
edy555 | 0:55201637d936 | 6 | extern int16_t htstat_buf[HILBERT_TRANSFORM_FIRSTATE_LENGTH]; |
edy555 | 0:55201637d936 | 7 | // capture interval 10ms onto double buffer (5ms each) |
edy555 | 0:55201637d936 | 8 | // 48kHz x 2ch * 5ms = 240*2 |
edy555 | 0:55201637d936 | 9 | #define CAPTURE_LEN 240*2 |
edy555 | 0:55201637d936 | 10 | extern int16_t cap_buf[2][CAPTURE_LEN]; |
edy555 | 0:55201637d936 | 11 | // 240*2 * 4 = 1920, single buffer |
edy555 | 0:55201637d936 | 12 | #define FIRSTATE_LENGTH 16*2 |
edy555 | 0:55201637d936 | 13 | extern int16_t fir_state[FIRSTATE_LENGTH]; |
edy555 | 0:55201637d936 | 14 | extern int16_t fir_buf[CAPTURE_LEN]; |
edy555 | 0:55201637d936 | 15 | #define CICBUF_LEN 1920 |
edy555 | 0:55201637d936 | 16 | extern int16_t cic_buf[CICBUF_LEN]; |
edy555 | 0:55201637d936 | 17 | // 1920 * 10 = 19200, double buffer |
edy555 | 0:55201637d936 | 18 | #define DMA_DATALEN 19200 |
edy555 | 0:55201637d936 | 19 | extern int16_t dma_buf[2][DMA_DATALEN]; |
edy555 | 0:55201637d936 | 20 | |
edy555 | 0:55201637d936 | 21 | |
edy555 | 0:55201637d936 | 22 | typedef struct { |
edy555 | 0:55201637d936 | 23 | uint32_t p0; |
edy555 | 0:55201637d936 | 24 | uint32_t s0; |
edy555 | 0:55201637d936 | 25 | } CICState; |
edy555 | 0:55201637d936 | 26 | |
edy555 | 0:55201637d936 | 27 | extern CICState cic; |
edy555 | 0:55201637d936 | 28 | |
edy555 | 0:55201637d936 | 29 | void cic_interpolate_x10(CICState *cic, uint32_t *src, int src_len, uint32_t *dst); |
edy555 | 0:55201637d936 | 30 | |
edy555 | 0:55201637d936 | 31 | |
edy555 | 0:55201637d936 | 32 | void fir_resample_x4(uint32_t *src_state, uint32_t *dst, int dst_len); |
edy555 | 0:55201637d936 | 33 | |
edy555 | 0:55201637d936 | 34 | void interpolate_test(); |
edy555 | 0:55201637d936 | 35 | |
edy555 | 0:55201637d936 | 36 | void hilbert_transform(uint32_t *src, uint32_t *dst, int dst_len, int sign); |
edy555 | 0:55201637d936 | 37 | void hilbert_transform_save_fir_state(uint32_t *src_tail); |
edy555 | 0:55201637d936 | 38 | |
edy555 | 0:55201637d936 | 39 | void hilbert_transform_test(); |
edy555 | 0:55201637d936 | 40 | |
edy555 | 0:55201637d936 | 41 | |
edy555 | 0:55201637d936 | 42 | typedef struct { |
edy555 | 6:ed82052bd505 | 43 | uint16_t phase; |
edy555 | 0:55201637d936 | 44 | } FMModState; |
edy555 | 0:55201637d936 | 45 | |
edy555 | 0:55201637d936 | 46 | extern FMModState fmmod; |
edy555 | 0:55201637d936 | 47 | |
edy555 | 0:55201637d936 | 48 | //uint32_t cos_sin(int16_t x); |
edy555 | 0:55201637d936 | 49 | |
edy555 | 0:55201637d936 | 50 | void fmmod_init(FMModState *fmmod); |
edy555 | 0:55201637d936 | 51 | void frequency_modulation(FMModState *fmmod, uint32_t *src, uint32_t *dst, int dst_len); |
edy555 | 0:55201637d936 | 52 | |
edy555 | 0:55201637d936 | 53 | void amplitude_modulation(uint32_t *src, uint32_t *dst, int dst_len); |
edy555 | 0:55201637d936 | 54 | |
edy555 | 0:55201637d936 | 55 | |
edy555 | 0:55201637d936 | 56 | #endif /* _DSP_H_ */ |