Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
EIDE Van Hagar
Dec 8, 2000

Beep Boop
i do computer hardware things but i don't write drivers and i want to learn more about it.

Adbot
ADBOT LOVES YOU

EIDE Van Hagar
Dec 8, 2000

Beep Boop
i have this thing working now, i re-wrote some of the stuff in the adafruit arduino libraries to use the galileo board, but its quick and dirty, not as nice as the arduino gfx stuff in their libraries. it will show 4096 colors though, and i am working on making it display arbitrary bitmaps, the drawings on it are all just lines i wrote manually. i actually had to slow it down by adding a counter in the bit count modulation logic compared to the arduino libs. the arduino spends enough time drawing framebuffers that it leaves the LED on for a while, the quark was turning the led off so fast that the same programming sequence didn't work, i had to add some time to leave the LEDs on before i started programming the matrix again:

EIDE Van Hagar
Dec 8, 2000

Beep Boop
that union jack looking thing is just a test pattern i made so i could see which rows and columns are in the wrong place while I was fixing the timing. you can now draw an arbitrary graphics plane like from a bitmap or a gif or ppm and feed it into the planes and update the pointers to the plane you want using a counter. right now it has 4 framebuffers each capable of 4096 colors or fewer depending on how you set up color depth at compile time. point a framebuffer at an animated gif frame and you could set a counter to update whatver times per second or whatever

beep boop

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Bloody posted:

wish/hope im your santee

its not you but it is another well known shamefully nerdy yosposter. if you want i can post my source code to be ridiculed, i am a bad c++ programmer and i am sure i write it all as if it were system verilog and everything happens in zero simulation time with no regard for actual resources.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
i will post the full source when i actually have it drawing animated gifs and doing useful things. for now this is how i drew the test pattern:

code:

    for (int column = 0; column < PLANE_COLUMNS; column++) {
      for (int row = 0; row < PLANE_ROWS; row++) {
        // test pattern because i don't know what rows are wrong and where the timing is hosed
        // this should basically look like a combination of the rainbow flag and union jack
        
        // make the top and bottommost rows red, green just inside
        // top is bright as you can get and bottom is dim
        if (row==0) {
          r=0xf;
        }
        if (row==15) {
          r=0x1;
        }
        if (row==1) { 
          g=0xf;
        }
        if (row==14) {
          g=0x1;
        }
        
        // make the left and right columns blue, purple just inside, left side bright
        // and right side dim.  what about where the rows and columns intersect in the corners?
        // we just don't care, whichever thing we drew last wins
        if (column==0)  {
          b=0xf;
        }
        if (column==31) {
          b=0x9;
        }
        if (column==1) {
          b=r=0xf;
        }
        if(column==30) {
          b=r=0x1;
        }
        // draw a yellow and blue x intersecting in the middle of the panel #woah
        if (column == 2*row) {
          g=r=0xf;
        }
        if (column == -2*row+32) {
          g=b=0xf;
        }
        
        // draw a 2 pixel wide white and pinkcross in the middle of the panel 
        // make it pink because pink is pretty
        if (column==15 || row==8) {
          b=g=0xA;
          r=0xF;
        }
        if (row==7 || column==16) {
          b=r=g=0xA;
        }
        
        for (int color = 0; color < PLANE_COLORS; color++) {
            if (color == PLANE_RED)  {
              planes[plane][column][row][color] = r;
            }
            if (color == PLANE_GREEN)  {
              planes[plane][column][row][color] = g;
            }
            if (color == PLANE_BLUE)  {
              planes[plane][column][row][color] = b;
            }
        }
        r = b = g = 0;
      }
    }
    for (int row = 0; row < PLANE_ROWS; row++) {
      for (int column = 0; column < PLANE_COLUMNS; column++) {
           if (row<8) {
              buffer[column][row][BUF_R1] = planes[plane][column][row][PLANE_RED];
              buffer[column][row][BUF_G1] = planes[plane][column][row][PLANE_GREEN];
              buffer[column][row][BUF_B1] = planes[plane][column][row][PLANE_BLUE];
           } else {
              buffer[column][row-8][BUF_R2] = planes[plane][column][row][PLANE_RED];
              buffer[column][row-8][BUF_G2] = planes[plane][column][row][PLANE_GREEN];
              buffer[column][row-8][BUF_B2] = planes[plane][column][row][PLANE_BLUE];
           }
      }
    }

EIDE Van Hagar
Dec 8, 2000

Beep Boop
i am sure there is a better way to do that probably involving making the buffer a pointer to the plane or something so i can just change where in memory the image i want actually lives but hell if i know how to do that! especially when reformatting the plane into a buffer that has two rgb pixels 8 pixel rows apart in each buffer line.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
right now it updates the display in the arduino sketch loop like this:

code:
void loop() {
  
  for (int bcmBit = 1; bcmBit < (BIT_DEPTH+1); bcmBit++) { // which bit value we are using for BCM
    for (int iter = 0; iter < bcmBit; iter++) {            // how many iterations this bit gets
      for ( int row = 0; row < BUFFER_ROWS; row++ ) {      // update each row
    
        for (int wait=0; wait<50;wait++) {
          fastGpioDigitalWrite(OE,LOW);
        }
        
        fastGpioDigitalWrite(OE,HIGH);
        
        // set the address bits
        if ( row & 0x1 ) {
          fastGpioDigitalWrite(A,HIGH);
        } 
        else {
          fastGpioDigitalWrite(A,LOW);
        }
        if ( row & 0x2 ) {
          fastGpioDigitalWrite(B,HIGH);
        } 
        else {
          fastGpioDigitalWrite(B,LOW);
        }
        if ( row & 0x4 ) {
          fastGpioDigitalWrite(C,HIGH);
        } 
        else {
          fastGpioDigitalWrite(C,LOW);
        }
       
        
        for ( int column = 0; column < BUFFER_COLUMNS; column++ ) {
          
          if (0x1 & (buffer[column][row][0]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO0,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO0,LOW);
          }
          if (0x1 & (buffer[column][row][1]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO1,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO1,LOW);
          }
          if (0x1 & (buffer[column][row][2]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO2,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO2,LOW);
          }
          if (0x1 & (buffer[column][row][3]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO3,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO3,LOW);
          }
          if (0x1 & (buffer[column][row][4]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO4,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO4,LOW);
          }
          if (0x1 & (buffer[column][row][5]>>(bcmBit-1))) {
            fastGpioDigitalWrite(GPIO_FAST_IO5,HIGH);
          } 
          else {
            fastGpioDigitalWrite(GPIO_FAST_IO5,LOW);
          }
          fastGpioDigitalWrite(CLK,HIGH);
          fastGpioDigitalWrite(CLK,LOW);
         }   
        
        // latch data
        fastGpioDigitalWrite(LAT,HIGH);
        fastGpioDigitalWrite(LAT,LOW);
        
        fastGpioDigitalWrite(OE,LOW);
        
      }
    } 
  }
}
the loop where it writes to the OE (output enable) bit low 50 times in a row is the part i had to add to make it slow down. basically it tells the LEDs to stay on 50 times (output enable is active-low) in a row.

fastGpioDigitalWrite calls happen at about 600kHz. There is also a function fastGpioDigitalRegWriteUnsafe that requires you to keep track of register bits and writes destructively to the gpio registers, but i haven't figured out how to use all of that yet. fastGpioDigitalRegWriteUnsafe will push the clock from about 600 kHz to 2.9MHz, which could allow for something awesome lile RGB565 16-bit color.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
the bcmBit and iter loops are for binary code modulation. for the least significant bit it runs through the display loop (the "iter" or iteration loop) once. for the 2nd least significant bit it runs through the loop twice, and so on for each binary bit position.

basically, the more significant the bit in your binary value, the more times it loops through displaying that bit. the LED is on if it is a 1 and the LED is off it is a zero, so it displays the LSB once and the MSB however many times there are bits in the number. So basically your duty cycle depends on the MSB proportionally more than the LSB, so you end up with a duty cycle representative of the actual binary number.

if you look at that test pattern image, you can see that the bottom and rightmost pixels rows/columns are dimmer than the left and top rows/columns. that's 4 bits per r/g/b channel, or 12 bits per pixel, or 4096 colors total.

beep boop.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
fun fact 16 bit color is 565 because your eyeball is most sensitive to green so you put the most bits there.

this is why digital cameras with bayer sensors sample 2 green pixels for each blue and red pixel and interpolate the results.

in my real job i make display, graphics and camera hardware so this arduino stuff was disturbingly familiar.

also the adafruit people did a good job of figuring out how these panels work. even if its not documented officially the fact that their libraries work show you how it needs to be clocked.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

explain this right now. how do it work? what is a compact muon solenoid?

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Tin Gang posted:

this thread has got me itching and now I want to learn ARM microcontrollers

is this a good idea/what should I buy?

you should buy an intel brand galileo board in my extremely biased opinion.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
lol if you dont have a PHY with dynamic impedance compensation.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Mido posted:

I watched highly skilled engineers lose their loving minds over optimizing the gently caress out of things we didn't even really need

I just wrote a huge rambling essay about some architecture horrors I lived through during my time in embedded but decided to summarize it as follows

"if you have too many things going on for a cooperatively multi tasked series of services to work reliably, you should drop an actual RTOS on there and move on. do not make your own."

i read this and i think: faaaaaaart
just run x86 on it and be the fastest because that is how the real world works.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

movax posted:

the embedded stuff (atom, etc) comes closest, but even then, iirc its just multiple dies inside and the pch has all the peripherals -- x86 cores interface to any/all peripherals over pcie or dmi

one of the intel guys in the thread will probably correct me on that

i haven't really played around with it too much but i think the quark will have the old FSB architecture and the edison board that has silvermont cores will be the faster and lower power option. i know silvermont has the same IDI interface to the system agent that the big cores have now, and most of the stuff that is on-die will be hanging right off the system agent with IOSF or the intel memory requestor busses.

i know the galileo board has some of the GPIOs hanging off the north complex and some hanging off the south complex because i see the function for fastGpioDigigalRead that I am using calls two functions with NC or SC in the name depending on which pin I am writing to, and the NC and SC appear to be on-die in the quark because the pins go right from the quark to a level shifter. i dont really know what is going on on-die tho.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

maniacdevnull posted:

im a dumb hobbyist but microcontroller poo poo is fun as heck

i wired up a 4 digit 7 segment display and the first iteration i kept having some of the segments were dimmer than the others and when it finally clicked what i was doing wrong and how to resolve it i was all like :catdrugs:

just having to think about microseconds of delay and poo poo like that is a really fun exercise even if 'display 4 digits at a time' is a solved problem

it can definitely be fun and it's very satisfying when you figure out that what you were doing wrong in the programming sequence, yeah.

this must be what it feels like to work in post silicon verification except there's no money riding on me figuring out how to make this silly display work.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
sw8, i have this board booting linux off the sd card now, and i can read and write text files in the sketches, so images should be a quick next step.

i also have the sketch starting telnetd and i can talk to it over link-local ethernet so i should be able to get it to dhcp too and download things to display or fart noises to make or something.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Bloody posted:

yea that thing seems cool

iot is dumb as gently caress but it sure is making a lot of cool dev kits available for dirt cheap

i am sorry but before you can wash this load of laundry you need to update to LaundOS 4.3.7 or later.

Update? Y/N:

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Tin Gang posted:

I'm pretty much the opposite now because I don't like high level programming but I want to know how to build things out of transistors

this isn't as fun as it sounds but if you can do it there are people who will pay you to do it.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Sagebrush posted:

poll: is it pronounced "A T Tiny" or "at tiny"? "A T Mega" or "at mega"?

i pronounce the letters individually but someone else i know pronounces it at-whatever and it drives me up the wall

"shameful"

EIDE Van Hagar
Dec 8, 2000

Beep Boop

sund posted:

coworker heard i liked jigsaw puzzles and brought me some sweet vendor swag


this looks like a real mess this person should probably invest in some simulators.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

movax posted:

Iirc they shrink wrapped and protected his desk

the turbo encabulator is buried in it, never to be seen

this is the best version of that, imo.
https://www.youtube.com/watch?v=RXJKdh1KZ0w

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Mr Dog posted:

lol does it still break out GPIOs onto separate chips interfaced over I2C?

i don't think the edison board ever did this. the first galileo board only had low-speed gpio on expanders, but the current galileo board has 12 high speed gpio pins right off of the SoC and more on an i2c expander. i am pretty sure the edison board has at least that many high speed gpios but i haven't worked with it so i'm not sure and i can't be bothered to look it up.

i know this because my secret santa gift required all 12 gpios on the galileo board, they can operate at 1.2 or 2.9 MHz, depending on the pin (different pullup resistors and output capacitors).

EIDE Van Hagar
Dec 8, 2000

Beep Boop

eschaton posted:

the Edison can be configured for up to 44 GPIO pins, though as always the pins are shared by other interfaces.

this sounds pretty rad. here is what i made with 12 full speed gpios:





EIDE Van Hagar
Dec 8, 2000

Beep Boop

eschaton posted:

sweet! what kind of LED matrix is that? I assume it's i2c?

no its the one they sell at adafruit, it needs more than i2c, i will post the source code in a bit when i upload it. it needs a 3-bit led address, red green and blue values for each LED, and it has to be refreshed many times a screen to display colors.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
i am an idiot forget about this. i broke my internet.

EIDE Van Hagar fucked around with this message at 06:30 on Jan 9, 2015

EIDE Van Hagar
Dec 8, 2000

Beep Boop

hobbesmaster posted:

please tell me theres a speaker too

you could add a speaker but its just the display right now:
https://www.youtube.com/watch?v=Iz_3PlxRLOA
16x32 rgb leds. this video was from testing, it just cycles randomly.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Sagebrush posted:

You can drive 512 ws2811-type rgb leds at 30Hz with a bog standard avr and a single data line fyi, as long as it has about 2k of ram and >16mhz

I.e., an arduino

You don't by any means need 12 gpio and an Intel processor

this particular LED panel requires 12 inputs and you have to manually turn every LED on and off, but it's also capable of daisy chaining so you can really drive a lot more LEDs with those 12 pins, you just have to read in the data for the furthest panel, 2nd furthest, and so on until you get to the closest panel. i had two panels hooked up to it at one point and i didn't see any performance problems, i think i am going to do a project eventually with 6-8 panels but this is a fun yosmas gift i thought.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
cell phone socs have a bunch of stuff that would be an ASIC in the past, image processors, video encoders/decoders, display blitters and so on, if you want to do that.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

let it take 2 cycles to look up and see if it still happens

yeah this or slow the clock down maybe?

i assume there is some signal that determines if its a hit and maybe its just taking longer than a clock.

is it a CAM?

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Bloody posted:

explaining spi is nice because it's so loosely defined. the poo poo i have seen, man. i have seen some poo poo. lvds spi. ddr spi. spi where chip select actually does nothing and god help you if you have anything but the most pristine clock line from power up until forever.

gently caress spi.

i2c is nice if you don't mind some slow as rear end upper limit and don't have to talk to it with an fpga

i2c ultra fast mode can do 5Mb/s, oooh yeaaaaaah, i did pre-silicon verification of the i2c and displayport aux channel controller in bay trail and i used to have dreams about i2c i spent so much time fiddling with it in the day for a few weeks there

EIDE Van Hagar
Dec 8, 2000

Beep Boop

movax posted:

i have sometimes woken up in bed and laid there unmoving for several minutes before realizing that i do not, in fact, require a clock signal to function properly

always @ (posedge sun) begin
toilet <= poop:
end

EIDE Van Hagar fucked around with this message at 02:44 on Apr 4, 2015

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

lmao oic

c# does some of that with autogenerated files from the GUI designer, but i haven't had to merge too many of those

just do pure verilog imho

design and test everything in systemverilog, god's own language.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

async clock crossing is sweet, one of those concepts that took 1.5 passes for me to understand

gray codes, bubble gaps, its all p. neat

once long ago i found a bug in a display controller that was causing a pixel to get dropped and i spent a whole day figuring out that it was an issue with a clock crossing fifo and i think that was the first time i really understood it

EIDE Van Hagar
Dec 8, 2000

Beep Boop
generators are nice for making a bunch of config registers from a set of basic definitions about what the bits in each register do and not needing to hand code up a bunch of registers, or for hooking up a bunch of interrupt wires into status registers where you are going through several definitions of what interrupt status goes to each bit as a project evolves and you want to just be able to change a list of bits and what they do and have them automatically make registers. you don't need it, but for certain things where you know you are gonna have the same RTL repeated hundreds or thousands of times it can make the RTL generation and the process of stitching it all together a lot easier.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

Bloody posted:

is there a way to parameterize a range in verilog? like i can do:
code:
localparam top = 7;
localparam bot = 0;
reg [31:0] foo;
...
if(foo[top:bot] == 8'haa)...
is there a way to just make top:bot as a named parameter so i can just have foo[range] instead?

like
code:
localparam range = 7:0;

if(foo[range] == 8'haa)...

you can do a indexed part select to pick out a range

EIDE Van Hagar
Dec 8, 2000

Beep Boop
http://www.esperan.com/view_tutorial.php?tutorialNumber=21

useful for packing and unpacking bits, like when you are selecting a smaller chunk of a large piece of data one chunk at a time. for serializing parallel data or gathering serial data into a larger parallel data structure or something.

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

i have a genuine, burning hatred for tutorials that act like simulation-only constructs are Good and the synthesizable subset is some wacky restriction that a Good Designer wouldn't sully themselves with

$display("hello world") is not a HDL's hello world, blink a freakin LED or something

i work in validation so i don't care about synthesizability at all, generally.

EIDE Van Hagar
Dec 8, 2000

Beep Boop
hey thread. question: i have been wanting to get an fpga and start a github with all the poo poo i make it do but i have been too lazy to fpga shop. what is a good one to get that i can do things on for like $1000? where do you even find that out? are there toolchains i can use on my mac?

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

oh wow, look who suddenly cares about synthesizability

only for fun :colbert:

Adbot
ADBOT LOVES YOU

EIDE Van Hagar
Dec 8, 2000

Beep Boop

JawnV6 posted:

he thinks synthesizing is unimportant for validation, imma guess emulation isn't his forte :xd:

you'd be correct i don't do emulation

  • Locked thread