Making a video player: ATMEGA328+23LC1024+ST7735+VLSI1053

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a new school project and I can choose what to make out of microcontrollers. I'm rejecting ATXMEGA128A1 because there's nothing to support it and its JTAG. No RTOS-es are compatible with it.

I'm choosing ATMEGA328 instead because it's DIP so that I don't have to solder anything and it's compatible with Arduino and there's also a version with built in Arduino bootloader.

 

I'm thinking of making a video player. There have been challenges because of which this couldn't have been done, but I found possible solutions.

 

As video and picture viewing takes a lot of RAM and ATMEGAs have only a few kilobytes of it, I was thinking of using an extra RAM chip to solve this problem. The extra RAM chip is called 23LC1024. More explanation here:

https://ucexperiment.wordpress.c...

http://ww1.microchip.com/downloa...

It has a neat Serial Quad Interface which is probably faster than the regular Serial Peripheral Interface. With some asm code processing the bits, I think this might work very well.

How many of these would I need for a perfect 128x160 JPEG decoding (reason why JPEG will be explained later)? One has 1MB RAM.

 

The video format in question is SMV. According to this site: http://www.miriamruiz.es/weblog/...

An SMV file has three sections, concatenated together:

  1. An IMA ADPCM .wav file, with header.
  2. An SMV header.
  3. A number of .jpeg files, with headers, each prepended by a 24-bit (3-byte) little-endian value representing the size, and buffered at the end with nulls, so that they are at predictable locations (the jpeg modulo). SMV is a constant-bit-rate format, but the underlying format (jpeg) is not. Proprietary encoders -according to smvconv’s author- probably make up for this by encoding at various qualities until a jpeg of the proper size is made.

I have a SMV converter that I got from a video player's CD.

Now, I don't know is there an JPEG reading algorithm so that I can open and decode those JPEGs. Especially for AVR. If there is, the fopen() will be used and I don't think AVR-GCC library has that. Maybe the FreeRTOS has it.

 

To display the picture, I'm using this display: http://www.elecfreaks.com/store/... and I have it right now.

The video size will be 128x160 and maximum frame rate 24.

 

The audio playing will be handled by the famous audio playing chip VLSI1053. http://www.vlsi.fi/en/products/v... It supports IMA ADPCM which is great!

 

Do you think this would work together? Would JPEG decoding take too long? As all elements will with on 3.3V, the maximum frequency will be 13MHz. Would that be enough?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Do you think this would work together?

I doubt it.

The 328 may not have enough FLASH to handle such a program, and it does not clock fast enough to support full motion video and SPI RAM at 20Mhz IMO won't cut it ,

Have a video decoder?

 

Now some video decoders, and audio decoders can operate on their own with the micro simply supplying control signals.  In that case, then you might have something.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm rejecting ATXMEGA128A1

That is a good thing, you better go with the AxU which superseeds the deprecated Ax.

because there's nothing to support it and its JTAG. No RTOS-es are compatible with it.

Regarding the JTAG support, the official JTAG Ice MkII supports all of them http://www.atmel.com/webdoc/atmelstudio/supported.devices.AVR.Xmega.html

Regarding the RTOS, it should not rely on the hardware, if your device is not supported out-of-the-box, then you should try to port the RTOS to support it.

Or as you did, select an already supported device.

 

Regarding your project, I agree with Jim, it is not a simple task for such a small (in terms of capabilities) device.

Have a nice day,
Kraal

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The video size will be 128x160 and maximum frame rate 24.

You didn't say what colour resolution but let's assume YUV so an effective 16bits (2 bytes) per pixel. You are therefore going to have to be blitting 128x160x24x2 bytes per second to make display updates (and this is just raw data -  no allowance for the decode of any container format). That is 983,040 bytes per second or roughly 1MHz. Even if you run your AVR at 16MHz that means just 16 CPU cycles (perhaps 10 opcodes?) per byte to be transferred. So in your 10 opcodes you have to retrieve each byte and, as I say that might include some form of format decode (like MPEG or MJPEG or something?), and then pass this to the display device. There's also the question (if for example you are decoding some video format) of RAM for processing.

 

On most scores something as puny as a mega328 fails.

 

I'd be looking at using an ARM with a few hundred MHz. At the very least perhaps a Cortex M4 at 120MHz with a few hundred K of RAM.

 

In fact the obvious candidates for this kind of thing at a "hobbyist" price these days are the Raspberry Pi's and the Beaglebone's. For about $30 you should be able to decode and display any video format your heart desires (and probably considerably more than 128x160 YUV if you want). Of course no one using those boards (and hence Linux) actually writes the MPEG decode themselves. You just link to libavcodec (just like ffmpeg, vlc and others do) and use the encoders/decoders it provides. In fact Linux is a lot like Arduino in this sense. There's a pre-written library for almost everything so you just concentrate on the high level "glue" and user interface and rely on library code for things like file storage, video decode, still image decode and stuff like that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For about $30 you should be able to decode and display any video format your heart desires (and probably considerably more than 128x160 YUV if you want)

I have not looked at my Rpi lately, but I think it has an HDMI interface on it, so you can certainly hit much nicer video displays than 128x160.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
I have not looked at my Rpi lately, but I think it has an HDMI interface on it

Yes, it does.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The "fun factor" of simply plugging an HDMI lead into an HDMI monitor may be lower though!

 

For attaching LCD to Rpi see:

 

http://elinux.org/RPi_Screens#In...

 

However that makes the point that using a parallel bus LCD you may not have enough digital IO from Rpi for a TFT with a 16 bit bus. I think the Beaglebone may be a better contender as I think it has more usable IOs

For example:

 

http://elinux.org/CircuitCo:Beag...

Last Edited: Fri. Mar 27, 2015 - 12:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The reason why I don't like Raspberry Pi is because all libraries are for Linux and they're (including Linux) GPL which means I cannot profit from anything and not even make my own license where someone else can profit.

 

Tell me, is there an OS or RTOS or libraries for Raspberry Pi with a png license or MIT license or similar?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How many commercial products are out there that run Linux? Wireless routers,mobile phones etc.....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm thinking of making my OS forkable in such a way that anyone can profit from it as much as they like as long as they edit it and give me credit. GPL prevents me from that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Foxcat385 wrote:
GPL which means I cannot profit from anything

No, that's not true at all.

 

Plenty of individuals & organisations make money from Open Source

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But the program must be free without DRM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Foxy, you're really not making sense. You're not forced to run Linux on a raspi and you don't eventhave to run any form of os. Just write your code and run it. DRM - that's another ball game.

Last Edited: Sat. Mar 28, 2015 - 01:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"free" as in "speech" - not necessarily "free" as in "beer"

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are confusing GPL, the kernel of Linux is, indeed, GPL so if you modify the kernel or modprobe / insmod driver code that may be "derived work" and subject to GPL. But at the app level the licences may be varied. The last 5 million units I've had a hand in implementing have been Linux based and we haven't been required to publish source for any of them. 

 

You can use none GPL operating systems like Vxworks if you prefer and they have a fair range of library / protocol support but nothing like Linux.