Hi,
I am planning to add a Digital TV tuners (DVB) support to the ESP32.
This job may be split in two parts:
1) Tuner-demodulator control using a I2C - It is a trivial task.
2) Transport Stream (TS) capture and demultiplexing. This is the hardest part.
For better understanding, let me put here some background info about the TS.
Usually, the transport stream coming from the tuner-demodulator is a serial bit-stream with a bit rate about 160 Mbps. The transport stream consists of packets. Each packet is 188-byte length.
Each packet starts with a sync byte (0x47) and has a Packet ID (PID) field (13 bit) inside a standard header. Packets with the same PID will form the elementary stream called PES.
The principal objective of the capture task is to store packets with the same PID in the dedicated memory fifo buffer. Thus we will create a PES stream for further processing.
The number of PES and corresponding PIDs should be configured by user. All others packets should be dropped.
So, my questions are:
Does anyone have experience in this matter?
Could someone else share any ideas about such task and how it could be implemented
in esp32 hardware interfaces and DMA?
Thank you for your time.
Digital TV tuners (DVB-C/T/S) support in ESP32
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Sorry guys. I think I should be more specific in my previous post.
Here are some additional points.
1. The main project goal is to capture Stream Information Tables, extract useful info and send it over WiFi to the final user. It could be Program Guide (EPG), NIT info etc. Optionally, if CPU power will permits, audio and video stream could be streamed to user as well.
2. Below is a TS output interface timing diagram for the typical satellite demodulator.
Here are some additional points.
1. The main project goal is to capture Stream Information Tables, extract useful info and send it over WiFi to the final user. It could be Program Guide (EPG), NIT info etc. Optionally, if CPU power will permits, audio and video stream could be streamed to user as well.
2. Below is a TS output interface timing diagram for the typical satellite demodulator.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
160MBps over a single line implies a serial clock of 160MHz. I don't think we have anything in the ESP32 that can sample that natively... if any, you'd need external hardware to feed it into the ESP32 at a lower clock rate somehow.
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Thank you ESP_Sprite.
160 Mb/sec is a highest bit rate supported by demodulator according to Montage M88DS3103 Data Sheet.
In real life bit rates used by broadcast operators are much lower.
DVB-S2 (Satellite transmission) bit rate depend on particular transponder and can variate from 10 to 65 Mb/sec
DVB-C (Cable transmission), the bit rate can variate from 6,41 to 64.11 Mb/sec
DVB-T2 (Terrestrial transmission) From 7,44 to 50.32 Mb/sec
I saw that ESP32 SPI is able to support clocks up to 80 MHz with 64-byte FIFO
So, does it means, that theoretically ESP32 can handle such bit rates (30-40 Mb/sec) in a slave mode.
Thank you
160 Mb/sec is a highest bit rate supported by demodulator according to Montage M88DS3103 Data Sheet.
In real life bit rates used by broadcast operators are much lower.
DVB-S2 (Satellite transmission) bit rate depend on particular transponder and can variate from 10 to 65 Mb/sec
DVB-C (Cable transmission), the bit rate can variate from 6,41 to 64.11 Mb/sec
DVB-T2 (Terrestrial transmission) From 7,44 to 50.32 Mb/sec
I saw that ESP32 SPI is able to support clocks up to 80 MHz with 64-byte FIFO
So, does it means, that theoretically ESP32 can handle such bit rates (30-40 Mb/sec) in a slave mode.
Thank you
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Yes, I think that should be doable, given that you use the 'native' SPI pins. On a software level, our slave SPI driver doesn't really support streaming data, however, so you may need to control the SPI hardware yourself. (Probably need it to act more like an I2S peripheral, that is, streaming instead of transaction-based.)
Only issue may be the M_SYNC signal that is used to sync up the bytes: the SPI hardware doesn't have native support for this. With an external flipflop or something, you may be able to convert that into a /CS signal to start the transmission, and hope it stays locked from there. Or maybe just ignore M_SYNC, start on a random bit, and if the incoming stream does not make sense, retry: there's an 1/8th chance you get it right each time.
Only issue may be the M_SYNC signal that is used to sync up the bytes: the SPI hardware doesn't have native support for this. With an external flipflop or something, you may be able to convert that into a /CS signal to start the transmission, and hope it stays locked from there. Or maybe just ignore M_SYNC, start on a random bit, and if the incoming stream does not make sense, retry: there's an 1/8th chance you get it right each time.
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Ok, thanks.
Converting M_SYNC to CS signal seems to be a good idea. This probably need a counter to 188 clocks.
But there is also another trouble:
A Hi-speed stream capture process should run without CPU intervention.
Restarting DMA transfer, (considering 2us Interrupt latency) will case a packets lost.
Unfortunately the Esp32 Tech reference doesn't say much about an internal SPI organization, especially when it pared with DMA.
As I understood there is no possibility to continuously run DMA linked list operations in a cyclic loop.
Is it correct?
Converting M_SYNC to CS signal seems to be a good idea. This probably need a counter to 188 clocks.
But there is also another trouble:
A Hi-speed stream capture process should run without CPU intervention.
Restarting DMA transfer, (considering 2us Interrupt latency) will case a packets lost.
Unfortunately the Esp32 Tech reference doesn't say much about an internal SPI organization, especially when it pared with DMA.
As I understood there is no possibility to continuously run DMA linked list operations in a cyclic loop.
Is it correct?
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Yes, the hardware should be able to do that.
Re: Digital TV tuners (DVB-C/T/S) support in ESP32
Sorry to revive this old thread, but I'm also interested in this subject. Did you manage to turn your ESP32 into a digital TV tuner?
Who is online
Users browsing this forum: No registered users and 45 guests