I will implement this FIR filter with decimation:

`#`

# Python script to calculate

# FIR coefficients with remez algorithm

#

import numpy as np

from scipy import signal

import matplotlib.pyplot as plt

fs = 2500000/8 # Sample rate, Hz

cutoff = 5000 # Desired cutoff frequency, Hz

R = 8 # Decimation factor

numtaps = 128 # Size of the FIR filter.

def plot_response(fs, w, h, title):

plt.figure()

plt.plot(0.5*fs*w/np.pi, 20*np.log10(np.abs(h)))

plt.ylim(-100, 5)

plt.xlim(0, 0.1*fs)

plt.grid(True)

plt.xlabel('Frequency (Hz)')

plt.ylabel('Gain (dB)')

plt.title(title)

plt.show()

bands = [0, cutoff, 0.5*fs/R, 0.5*fs]

gains = [1, 0]

taps = signal.remez(numtaps, bands, gains, fs=fs)

q31_taps =[round(t*2**31) for t in taps]

q31_taps =[t if t>0 else t+0x100000000 for t in q31_taps]

q31_taps =[f"0x{t:08X}" for t in q31_taps]

print(", ".join(q31_taps))

w, h = signal.freqz(taps, [1], worN=2000)

plot_response(fs, w, h, "Low-pass Filter")

Coefficients:

`0x000049C7, 0x0000772C, 0x0000CB3A, 0x00013881, 0x0001BB5F, 0x00024B04, `

0x0002D885, 0x00034EBB, 0x0003929D, 0x000384B1, 0x0003039C, 0x0001EFAF,

0x00002F49, 0xFFFDB3F3, 0xFFFA7FA7, 0xFFF6A9B3, 0xFFF2627B, 0xFFEDF586,

0xFFE9C926, 0xFFE65B27, 0xFFE43A12, 0xFFE3FB19, 0xFFE62CEB, 0xFFEB480A,

0xFFF39DB4, 0xFFFF46B9, 0x000E13FE, 0x001F827C, 0x0032B476, 0x004671A1,

0x00592F84, 0x006922CC, 0x007459B4, 0x0078DEB1, 0x0074E1CF, 0x0066E66C,

0x004DF219, 0x0029B90B, 0xFFFAC421, 0xFFC28C93, 0xFF8389B0, 0xFF412DC7,

0xFEFFD05B, 0xFEC4850D, 0xFE94DFFB, 0xFE76A9FE, 0xFE6F8879, 0xFE849DEF,

0xFEBA295F, 0xFF132B0E, 0xFF91159F, 0x003391C1, 0x00F85A01, 0x01DB32D5,

0x02D6012C, 0x03E0FFE0, 0x04F31216, 0x06022E96, 0x0703DE4B, 0x07EDC657,

0x08B6356D, 0x0954AB63, 0x09C25247, 0x09FA6101, 0x09FA6101, 0x09C25247,

0x0954AB63, 0x08B6356D, 0x07EDC657, 0x0703DE4B, 0x06022E96, 0x04F31216,

0x03E0FFE0, 0x02D6012C, 0x01DB32D5, 0x00F85A01, 0x003391C1, 0xFF91159F,

0xFF132B0E, 0xFEBA295F, 0xFE849DEF, 0xFE6F8879, 0xFE76A9FE, 0xFE94DFFB,

0xFEC4850D, 0xFEFFD05B, 0xFF412DC7, 0xFF8389B0, 0xFFC28C93, 0xFFFAC421,

0x0029B90B, 0x004DF219, 0x0066E66C, 0x0074E1CF, 0x0078DEB1, 0x007459B4,

0x006922CC, 0x00592F84, 0x004671A1, 0x0032B476, 0x001F827C, 0x000E13FE,

0xFFFF46B9, 0xFFF39DB4, 0xFFEB480A, 0xFFE62CEB, 0xFFE3FB19, 0xFFE43A12,

0xFFE65B27, 0xFFE9C926, 0xFFEDF586, 0xFFF2627B, 0xFFF6A9B3, 0xFFFA7FA7,

0xFFFDB3F3, 0x00002F49, 0x0001EFAF, 0x0003039C, 0x000384B1, 0x0003929D,

0x00034EBB, 0x0002D885, 0x00024B04, 0x0001BB5F, 0x00013881, 0x0000CB3A,

0x0000772C, 0x000049C7