Closed roman3017 closed 4 years ago
NexysA7 already has audio out. Unfortunately, it is mono. Will have a look at driver once I get to audio. The signal needs to be driven low for logic ‘0’ and left in high-impedance for logic ‘1’. An on-board pull-up resistor to a clean analog 3.3V rail will establish the proper voltage for logic ‘1’. I wonder if this will become an issue: https://reference.digilentinc.com/reference/programmable-logic/nexys-4-ddr/reference-manual
Currently, I am working on VGA. I am trying to get 800x600@72Hz to work with pixel clock 50MHz. Since this resolution requires hsync and vsync polarity change, I am modifying VGA controller to enable polarity. Will let you know once done.
Mono audio is working ok on NexysA7. But have to turn on AUD_SD pin too:
root@buildroot:~# mpg123 -m sample3.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.25.13; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Terminal control enabled, press 'h' for listing of keys and functions.
Playing MPEG stream 1 of 1: sample3.mp3 ...
MPEG 1.0 L III vbr 44100 j-s
[ 1697.217164] spinal,lib-audio-out 10094000.audio_out: Start rate=44100 cha=1 0
[1:45] Decoding of sample3.mp3 finished.
For some reason VGA is not working for me even for 640x480@60Hz resolution with pixel clock 25MHz. But audio works well.
Did you scoped the signal on the VGA ?
@Dolu1990 Today I scoped the VGA signals. Both HS and VS look ok. I see blanking at expected periods around 31.5kHz and 60Hz. Signal levels are around 3V. Maybe there is something wrong with my cable. But based on the scope VGA works fine.
I had to add second channel to audio since 1 channel does not compile anymore after rebasing to the latest. Audio works fine too and changes were pushed.
I think this can be merged unless you have some suggestions to change.
Hi Roman,
Basically there is backpoch but integrated into another way. For instance if you look https://www.digikey.com/eewiki/download/attachments/15925278/signal_timing_diagram.jpg?version=1&modificationDate=1368216804290&api=v2
The placed the display are at top left, changing the phase of everything to place it somewhere further right down allow the DMA to have more time buffing the frame.
Hmm, Can you see some color on the VGA signal itself ? or only v/h sync ?
On Sat, Sep 26, 2020 at 8:32 PM roman3017 notifications@github.com wrote:
@Dolu1990 https://github.com/Dolu1990 Maybe I misunderstand but looking at VGA controller, are we missing back porch part? https://www.digikey.com/eewiki/pages/viewpage.action?pageId=15925278
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SpinalHDL/SaxonSoc/pull/48#issuecomment-699531842, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE3WUXC43OV5AMBPW652D3SHYXVRANCNFSM4RTMWAKQ .
Hoo one thing is that to properly see the VGA signal, you realy need to have the VGA pluged, or at least a 75 ohm resistor to the ground., that explaine the 3V
I see colors. It is just my display shows as if vsync is wrong and image is not clear and vertically moves. Which is why I am looking closely at vsync signal and timing. But on scope each signal looks ok and even display shows the correct resolution has been detected. I must try some other cable once I find one.
@Dolu1990 Finally I have fixed VGA. My vgaInit was wrong. I had buffer size set to allocated size, which is bigger than the actual size. Since DMA is set withCircularMode, it caused misalignment. Both audio and vga work now on NexysA7.
It is amazing to observe fb-test-rect drawing in background and listen to mpg123 at the same time without single glitch.
I have got also resolutions with positive sync pulses working and can send PR to SpinalHDL, which enables them: https://github.com/roman3017/SaxonSoc/commit/8496c637a69eeffd05700dfb1e63fea88bb85d05 https://github.com/roman3017/SpinalHDL/commit/b4516006e01dcd300bd335807a471649a54df169 These two should be merged together.
With these changes one can use this in vgaInit:
#define VGA_TIMINGS vga_h800_v600_r60
#define VGA_WIDTH 800
#define VGA_HEIGHT 600
Linux DTS framebuffer node needs to be modified too:
framebuffer0: framebuffer@87000000 {
compatible = "simple-framebuffer";
reg = <0x87000000 (800 * 600 * 2)>;
width = <800>;
height = <600>;
stride = <(800 * 2)>;
format = "r5g6b5";
};
Added resolutions have nice exact pixel clocks 40MHz and 50MHz.
One can also play mp4/h264 but it is bit slow. I am getting only 2.1fps (also because my sample file uses yuv format) with:
root@buildroot:~# ffmpeg -i sample.mp4 -pix_fmt rgb565le -f fbdev /dev/fb0
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.4.0 (Buildroot 2020.02.1-00060-g3b50d3e32a-dirty)
configuration: --enable-cross-compile --cross-prefix=
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:21.76, start: 0.000000, bitrate: 494 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 424 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (d)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[swscaler @ 0xd2440] No accelerated colorspace conversion found from yuv420p to rgb565le.
Output #0, fbdev, to '/dev/fb0':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 640x360, q=2-31, 110592 kb/s, 30 fps, 30 tbn, 30 tbc)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.54.100 rawvideo
frame= 648 fps=2.1 q=-0.0 Lsize=N/A time=00:00:21.66 bitrate=N/A speed=0.0693x
video:291600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
I have got also resolutions with positive sync pulses
Nice :D So, just one thing to be carefull about is backward compatibility, i will add a init(False) to the polarity.
One can also play mp4/h264
XD I didn't event tried it. Cool to know that it works :D Hopefully it could work in realy time for much lower resolution
Thanks :D
This PR does not have polarity changes, which I have on a different branch. I will create new PR for adding polarities once this one is done with so they do not get mixed up. This PR has only NexysA7 changes. So the last two commits from here are outstanding for another PR: https://github.com/roman3017/SaxonSoc/commits/vga
SpinalHDL PR merged let's me know when you are ready for the SaxonSoc merge ^^
I have created https://github.com/SpinalHDL/SaxonSoc/pull/49, which contain all outstanding patches. Will cancel this one.
@roman3017 For fun, i just tested with NaxRiscv, rv64imafdc @100 Mhz with 16 KB i$ 16KB d$ and got frame= 901 fps=5.5 q=-0.0 Lsize=N/A time=00:00:30.03 bitrate=N/A speed=0.182x
using https://file-examples.com/storage/fe7d3a0d44631509da1f416/2017/04/file_example_MP4_640_3MG.mp4
Do you remember which video exactly you were using ?
Also, do you remember if it was dual or single core ?
Great, so it went from 2.1fps to 5.5fps. I do not have the sample file anymore but it was dual core. I should try NaxRiscv one of these days, looks great.
:)
Hi ^^
You can activate stereo sound if you want instead of mono, currently the driver expect stereo, so it might do weird things XD
https://github.com/SpinalHDL/SaxonSoc/pull/48/files#diff-99df7f9cc57619d5c908490b00cb98cfR308