Closed snobu closed 5 years ago
Hello Adrian, i own an atmega2560 but i have not tested it yet. In the future i will test it and add support to it, with a bigger vertical resolution. If you find some modification to be made, let me know.
Thank you! Sandro Maffiodo
On 01 Mar 2016, at 12:01, Adrian Calinescu notifications@github.com wrote:
Is ATmega2560 supported? I can't seem to make it work, triple checked the wiring, is there anything i need to change in the lib? It does compile and upload just fine but the monitor doesn't detect any signal. Thanks!
— Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4.
In theory if i connect to the PORTD pins on the Mega (which are different vs. Uno), i should be fine, right?
On second thought there aren't enough PORTD pins exposed on the Mega, maybe i should try going for PORTA or PORTC.
Is this where the magic happens? https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155
EDIT: Oh wait, they HAVE to be PWM pins, right? So i can't use PORTA or PORTC.
Yes you need to use another port. Keep in mind that the library write the 2 most significant bits of an 8bit port. (bit6 and bit7). The others 4 bits will be written too with garbage.
On 01 Mar 2016, at 14:32, Adrian Calinescu notifications@github.com wrote:
On second thought there aren't enough PORTD pins exposed on the Mega, maybe i should try going for PORTA or PORTC.
Is this where the magic happens? https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155 https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155 — Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4#issuecomment-190725609.
Your work on this library is outstanding and your understanding of the inner-workings of AVRs is seriously hard core. Congrats on both.
Now, back on topic, i've tried moving HSYNC and VSYNC to PIN 2 and 3 on the Mega to free up PORTB for Red and Green.
//HSYNC pin used by TIMER2
#define HSYNCPIN 2
//VSYNC pin used by TIMER1. Can be 9 or 10
#define VSYNCPIN 3
Then changed COLORPIN0 and COLORPIN1 to:
//These two pin cannot be modified without modify the HSYNC assembler code
#define COLORPIN0 12
#define COLORPIN1 13
And https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155 to PORTB:
: [port] "I" (_SFR_IO_ADDR(PORTB)),
Still no go. Maybe i need to adjust something in the assembly code too? Also, i'm not sure which pins MUST be PWM pins?
Hmm, TIMERs are hardwired to pins, so i need to take care of that.
http://playground.arduino.cc/Main/TimerPWMCheatsheet
For Arduino Mega: (tested on Arduino Mega 2560)
timer 0 (controls pin 13, 4)
timer 1 (controls pin 12, 11)
timer 2 (controls pin 10, 9)
timer 3 (controls pin 5, 3, 2)
timer 4 (controls pin 8, 7, 6)
EDIT: Ok, i have VSYNC and HSYNC working -> monitor says 640x480 31.2kHz 60Hz.
Still no pixels are being shown.
Hello! Thank you for your compliments!! :)
The HSYNC and VSYNC cannot be moved. Are PWM signals and if you move them you need to change the begin() method. Instead of move HSYNC and VSYNC try to use another port for the color signals, PORTK or PORTC?
The AUDIO pin can be moved on any pin but need a modification inside the assembler that generate the audio signal.
On 02 Mar 2016, at 09:35, Adrian Calinescu notifications@github.com wrote:
Your work on this library is outstanding and your understanding of the inner-workings of AVRs is seriously hard core. Congrats on both.
Now, back on topic, i've tried moving HSYNC and VSYNC to PIN 2 and 3 on the Mega to free up PORTB for Red and Green.
https://cloud.githubusercontent.com/assets/6472374/13454656/4692dd16-e061-11e5-9615-00beb336cbd2.png Changed COLORPIN0 and COLORPIN1 to:
//These two pin cannot be modified without modify the HSYNC assembler code
define COLORPIN0 12
define COLORPIN1 13
And https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155 https://github.com/smaffer/vgax/blob/58a7343188db070f2afb6f0da8f4700ac866e7fc/VGAX.cpp#L155 to PORTB:
: [port] "I" (_SFR_IO_ADDR(PORTB)), Still no go. Maybe i need to adjust something in the assembly code too? Also, i'm not sure which pins MUST be PWM pins?
— Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4#issuecomment-191128082.
Aaron! So on ATMEGA2560 you need to change HSYNC and VSYNC…
On 02 Mar 2016, at 09:53, Adrian Calinescu notifications@github.com wrote:
Hmm, TIMERs are hardwired to pins, so i need to take care of that.
http://playground.arduino.cc/Main/TimerPWMCheatsheet http://playground.arduino.cc/Main/TimerPWMCheatsheet For Arduino Mega: (tested on Arduino Mega 2560) timer 0 (controls pin 13, 4) timer 1 (controls pin 12, 11) timer 2 (controls pin 10, 9) timer 3 (controls pin 5, 3, 2) timer 4 (controls pin 8, 7, 6) — Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4#issuecomment-191134399.
http://sphinx.mythic-beasts.com/~markt/ATmega-timers.html
On 02 Mar 2016, at 10:59, Sandro Maffiodo smaffer@gmail.com wrote:
Aaron! So on ATMEGA2560 you need to change HSYNC and VSYNC…
On 02 Mar 2016, at 09:53, Adrian Calinescu <notifications@github.com mailto:notifications@github.com> wrote:
Hmm, TIMERs are hardwired to pins, so i need to take care of that.
http://playground.arduino.cc/Main/TimerPWMCheatsheet http://playground.arduino.cc/Main/TimerPWMCheatsheet For Arduino Mega: (tested on Arduino Mega 2560) timer 0 (controls pin 13, 4) timer 1 (controls pin 12, 11) timer 2 (controls pin 10, 9) timer 3 (controls pin 5, 3, 2) timer 4 (controls pin 8, 7, 6) — Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4#issuecomment-191134399.
I now have the VSYNC and HSYNC part figured out (thanks!), i have sync, monitor says 640x480 31.2kHz 60Hz
but screen is all black. Tried PORTA, PORTC, PORTF to no effect (Won't compile with PORTK). Not sure what i'm missing now.
Well! Have you tried PB7(D13) and PB6(D12) ? PC7(D30) and PC6(D31) ?
On 02 Mar 2016, at 11:19, Adrian Calinescu <notifications@github.com mailto:notifications@github.com> wrote:
I now have the VSYNC and HSYNC part figured out (thanks!), i have sync, monitor says 640x480 31.2kHz 60Hz but screen is all black. Tried PORTA, PORTC, PORTF to no effect (Won't compile with PORTK). Not sure what i'm missing now.
— Reply to this email directly or view it on GitHub https://github.com/smaffer/vgax/issues/4#issuecomment-191172028.
Yes.
PORTB D13, D12 -> blank screen PORTC D30, D31 -> blank screen PORTA D28, D29 -> blank screen PORTL D42, D43 -> blank screen
Not sure what to check next.
Monitor connectivity is good. Everything works if i flash to a UNO. Any idea what should i look into next? I feel like i reached a dead end here.
Did you succeed in using VGAX on mega2560 ? can you post all the modification that have to be done, maybe a pull request on the github : https://github.com/smaffer/vgax
I gave up midway through. In theory it should work. I've only got far enough to get Vsync, Hsync and a blank screen. I'm sure it's doable just needs more effort.
Hello! I have the same problem. Tried all ports. The screen is blank. VSYNC and HSYNC signals work normally.
Tried change port on Arduino UNO to PORTC - works normally. But in MEGA doesn't work.
Hi! I managed to make it work on the mega, I just couldn't make the anti jitter routine work! could anybody help? I don't know why it doesn't work on the mega
this is the part that needs to be commented out:
//interrupt jitter fix (needed to keep signal stable)
//code from https://github.com/cnlohr/avrcraft/tree/master/terminal
//modified from 4 nop align to 8 nop align
#define DEJITTER_OFFSET 1
#define DEJITTER_SYNC -3
asm volatile(
" lds r16, %[timer0] \n\t" //
//" add r16, %[toffset] \n\t" //
" subi r16, %[tsync] \n\t" //
" andi r16, 7 \n\t" //
" call TL \n\t" //
"TL: \n\t" //
" pop r31 \n\t" //
" pop r30 \n\t" //
" adiw r30, (LW-TL-5) \n\t" //
" add r30, r16 \n\t" //
//" adc r31, __zero_reg__ \n\t" //
" ijmp \n\t" //
"LW: \n\t" //
" nop \n\t" //
" nop \n\t" //
" nop \n\t" //
" nop \n\t" //
" nop \n\t" //
" nop \n\t" //
" nop \n\t" //
//" nop \n\t" //
"LBEND: \n\t" //
:
: [timer0] "i" (&TCNT0),
[toffset] "i" ((uint8_t)DEJITTER_OFFSET),
[tsync] "i" ((uint8_t)DEJITTER_SYNC)
: "r30", "r31", "r16", "r17");
probably the problem is here
//" adc r31, zero_reg \n\t" //
i'll test it later this week
Did any body get this worked on mega?
Nope. I just i2c'd together a Mega and a Uno and used the Uno for VGA.
is this project dead? Not seemed any response from author so long
I think it's awesome and short of magic, not dead. Maintaining things is a best effort.. Effort.
@smaffer @maujabur Just throwing this out there... what about the new SAMD based chips like the M0 - Arduino Zero/Adafruit Feather M0? Is there a chance we could get 640x480? That's my 4k standard for Arduino VGA. How much different is the assembly code from the AVR? 100%? :)
@snobu kt really is 100% different on assembly, I'll look for some library and let you know if I can find something.
@maujabur You have written that it works on your Mega2650. I got the H and V SYNC working, with
But i still get only black on the screen, i tried all Output Pins connected to bit 6 and bit7 on the board.
Outcommenting of jitter did non help/work for me. (can't compile)
What did you do, exactly?
@snobu i have released another lib for Arduino ESP8266: ESPVGAX. Video resolution is higher but color depth is lower (1bpp).
In the future i will try to port VGAX to ATMEGA2560 but i don't know when.
If someone has some working code, may create a branch and upload the code here, code will not be lost :)
I'M BACK! :D i've found all the problems with atmega2560, i'm now working on it :) These are the required changes:
#define HSYNCPIN 9
#define VSYNCPIN 11
#define COLORPIN0 30
#define COLORPIN1 31
for interrupt dejitter, atmega2560 seems to use a 22bit program counter, so the code must be changed like this:
" call TL \n\t" //
"TL: \n\t" //
" pop r17 \n\t" //
" pop r31 \n\t" //
" pop r30 \n\t" //
Timer0 setup must be changed to
//disable TIMER0 interrupt
TIMSK0=0;
TCCR0A=0;
TCCR0B=(1 << CS00); //enable 16MHz counter (used to fix the HSYNC interrupt jitter)
OCR0A=0;
OCR0B=0;
TCNT0=0;
Also PORTD must be changed to PORTC
I'm planning to release a new version that support both ATMEGA328 and ATMEGA2560. With ATMEGA2560 the vertical resolution can be increased to 90px (4:3 aspect ratio) or more. Coming soon!
On ATMEGA2560 is possible to achive 120x60px with 256 colors (RRRGGGBB)... is possible but need big changes to the library and tools. 120x90px with 16 colors (RGBH-RGBH) is also possible... I will think if have sense to write another library with these variations or write them on VGAX.
Thank you!
Hello! I've released a new version with ATMega2560 support. Resolution can be increased to 120x90px with squared pixels or 120x240px with rectangular pixels. Have fun!!
https://www.youtube.com/watch?v=Qs3uyhzUcfA 120x240px example :)
Hi! Thank you very much!
Best regards, Rostislav Varzar
На 14 апр. 2019 г., 13:28, в 13:28, Sandro Maffiodo notifications@github.com написал:п>Hello!
I've released a new version with ATMega2560 support. Resolution can be increased to 120x90px with squared pixels or 120x240px with rectangular pixels. Have fun!!
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/smaffer/vgax/issues/4#issuecomment-482943448
Is ATmega2560 supported? I can't seem to make it work, triple checked the wiring, is there something i need to change in the lib maybe? It does compile and upload just fine but the monitor doesn't detect any signal. Thanks!