Does Serialin use TIMER1 for anything? I cant recall if it does or not.
Basically, my project is a 16x16 LED Tile that is run from an ATmega8, making it a "smart" tile. the ATmega8 uses SPI to drive an array of CAT4016s. I had an issue with the SPI in the past, and was an SS issue which once it was fixed, it was fine.
But... I am having a very hard time getting data without corruption to the ATmega8. The ATmega8 tile is hooked to an ATXmega128 master board, using RS-485.
the RS-485 transmitter on the master board, is hard-wired in transmit mode all the time. The data coming from the master board is correct, I can use my 485 dongle and check that. it was ok.
but the tile itself gets corrupt packets 90% of the time. So, doing some further troubleshooting, I moved away from 16Mhz and 250K baud, to 14.7456Mhz at 115,200K baud.
Problem is, I still get glitches in the pixels, and lots of corruption. Maybe one or two packets come through.
So, I changed the serial port to Buffered instead of not, and that helped a little bit. But not much.
So, I tried changing cables from ribbon to twisted pair, no difference, messed with termination, etc and ruled out the RS-485 system.
The Tile is 1-to-2 multiplex using TIMER1.
So for shits and giggles, I Stopped Timer1 during the receive data routine, and then re-started timer1. Presto! problem solved! all the data is coming through correctly and accurately.
However, the downside is now the tile "flickers" every time I get data, as I have to stop the interrupts.
My question is has anyone done this type of thing before juggling time between multiplexing and receiving/buffering data? How do I get a proper balance an davoid flickering?
If you need to see the code let me know.
[b:2326f25273][color=red:2326f25273](BASCOM-AVR version : 2.0.7.8 )[/b:2326f25273][/color:2326f25273]
↧