View previous topic :: View next topic |
Author |
Message |
etalha
Joined: 10 May 2020 Posts: 2
|
Trying to make a device that plays video |
Posted: Mon Jun 01, 2020 3:56 am |
|
|
Hello,
I am trying to make a device that plays video (like a stream but from an sd card) or shows a picture on the touch screen. Can anybody give any advice? I want to use ccs c compiler and a pic microcontroller since I am quite used to them.
Best regards |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Mon Jun 01, 2020 9:52 am |
|
|
I have to say, honestly, not a good choice.
To actually 'play' video, requires the processor to perform decoding of
the data stream, and then output this to some form of video output.
The PIC is very difficult to make do jobs like this, since it lacks the ability
to have a memory mapped video buffer, which is really required to
do the output efficiently. Also, because the PIC is not suited to this
sort of task, few (no...) codecs are available prewritten for the PIC.
You could do this possibly 1000* easier with a device like the Pi,
for which codecs already exist to do the decoding, and supports video
output.
To do this on a PIC, is probably a minimum of about 6 months of
continuous coding, and would only be remotely possible on the fastest
PIC23/33 chips, and would not be a 'good' solution at the end... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Mon Jun 01, 2020 10:10 am |
|
|
Hmm 'video'....well it all depends on the 'specs'.....
Something lowres, black and white aka 'security camera' is fairly easy, and basic PICs can generate the required VGA data to send to a CRT or monitor.
It gets a LOT easier if you use an pre-made 'VGA module'.
Anything more, then you'll need a 'VGA module' and see if the specs of it are compatible with the 'video' you want to see.
Mr T is right it will take a LOT of time, but playing with PICs is fun !
Jay |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Jun 01, 2020 11:47 am |
|
|
I'm with Ttelmah on this one,
If you're talking about reading an SD card and decoding something like an MP4/AVI/MKV, that's a LOT of specialized math just to generate the frames.
There's a series of PIC24s that drive displays, but even then I don't think they have the math functions or bus speed to read off something like SPI at a rate fast enough to decode a modern video file.
And do you want audio with that?? Ouch.
There are CPUs really geared for this. the Pi is a good place to look... some of the other ARM based CPUs that have build in video generation, high-speed serial controllers specifically to work with SD cards at full speed and so on. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Tue Jun 02, 2020 12:51 am |
|
|
It really is a case of 'right tool for the job'.....
For a job wanting a low power CPU to do basic I/O tasks, the PIC is
brilliant. Include timing, ADC'c, and sequencing, equally good. But the maths
for video decoding, it is less suited for, and for video output very poorly
suited (though bkamen mentions PIC24's that drive displays, these are
for built in LCD controllers, not video output).
Jay is right, low resolution may well be 'possible', but honestly for anything
above this, 'think again'.... |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue Jun 02, 2020 1:15 am |
|
|
Ttelmah wrote: | It really is a case of 'right tool for the job'.....
(though bkamen mentions PIC24's that drive displays, these are
for built in LCD controllers, not video output). |
The PIC24 I'm thinking about can *be* an LCD controller (color too).
But there's no other peripheral to move the video stream into the frame buffer fast enough for anything... let alone also decoding MPEGs or whathaveyou.
I could see a nice B&W or color thermostat or some other smart home device with a touch screen with cute icons and all... but not video.
The instruction set isn't there.
The clock speeds aren't there.
The I/O to storage media isn't really there.
Yea... ARM32 with an RTOS or Linux with a rippin SDcard controller (4bit I/O @ 52MHz) with the cpu oomph to move that memory, process the data stream and work it into a video buffer......
I love PICs, but this is not what they're made for. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Tue Jun 02, 2020 4:58 am |
|
|
re: Quote: | It really is a case of 'right tool for the job' |
PICs are the right tools, the jobs are the wrong ones....
Still, it reminds me of using 8 bit ISA HD controller cards to get a 'powerhouse PIC', the 16F877, to have a 10MB harddrive for data storage. No such thing as flash drives or SD cards back then !!
'Video' requires a HUGE amount of data AND speed,something PICs generally don't have. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Tue Jun 02, 2020 6:14 am |
|
|
Yes.
I have to say, I'm currently developing an instrument, that draws a
coloured graph that animates every second onto a touch screen.
You have hidden buttons to display status, and access menus, and
a touch cursor to give the value at a point back in time.
On a PIC33EP512GM304, at 120MHz, and it runs very well (just tweaking
the final 'history' storage). But even at that speed there are momentary
delays when you touch a button, before the whole screen is redrawn....
Only perhaps a 1/4 second, but it shows just how much data has to move
to draw something that large (800*480*24bit). |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Tue Jun 02, 2020 6:32 am |
|
|
yeesh ! a quarter second is a 'lifetime of waiting', and that's running a very powerful PIC at 120 MHz with Mr. T's optimised code...
Hmm, makes me wonder if it's possible to 'overclock' PICs and if so how reliable they are ? I know older PCs could be overclocked, until you got into memory access issues and they'd lockup.... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Tue Jun 02, 2020 11:41 pm |
|
|
In this case it is because of the time needed to actually 'draw' the LCD
data. Even with DMA, a lot of work... |
|
|
|