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
JawnV6
Jul 4, 2004

So hot ...
how do i test freeRTOS tick rollover

0xffffffffms is ~49 days, I need some way to start it at 0xfffff000. lot of internal structure means I can't just jam that value in at reset

internally, there is literally nothing done to handle it. all the comparison math is ovf-safe, im not smart enough to make that same guarantee for my stuff

Adbot
ADBOT LOVES YOU

yippee cahier
Mar 28, 2005

JawnV6 posted:

how do i test freeRTOS tick rollover

0xffffffffms is ~49 days, I need some way to start it at 0xfffff000. lot of internal structure means I can't just jam that value in at reset

internally, there is literally nothing done to handle it. all the comparison math is ovf-safe, im not smart enough to make that same guarantee for my stuff

I think you can just jam it in there. tasks.c initializes it to zero statically and again when vTaskStartScheduler is called. xTaskIncrementTick handles the overflow event if you want to inspect that.

karasu
Jan 3, 2008

Bloody posted:

it's 2.0 only but a 32x8192 fifo fills in idk a few milliseconds in our system and we're just using a bulk endpoint because i didnt want to figure out how to use a different one and then make a different one go fast enough

also i doesn't super duper matter to the long-term system because some day this usb bridge will be a wireless link to another real-time device so... eh.

USB3 Bulk is just horrible without some kind of backpressure support or endless FIFO. I worked on a board that transferred about 220 MB/s and it had to use bulk (thanks USB3 Vision, why can't I use isochronous which is there for video ???).

Thing is, with bulk transfer Windows gives you the lowest priority to get rid of your data. Even just using the mouse or opening a browser would stop transfers for 10-20 miliseconds. Have fun compensating for that with FPGA SRAM. Isochronous transfers with enough reserved bandwith really help with that, especially with the data rate you're describing. But you do lose guaranteed packet delivery with it.

Bloody
Mar 3, 2013

I have a lot of control over the computer and the user so I should be able to compensate with a reasonably large dedicated fifo ram in the next revision

JawnV6
Jul 4, 2004

So hot ...

sund posted:

I think you can just jam it in there. tasks.c initializes it to zero statically and again when vTaskStartScheduler is called. xTaskIncrementTick handles the overflow event if you want to inspect that.

hm, I was convinced it'd to something stupid like not have any ready tasks. worth a shot, should have time to set it up later this week

anyway, ive finally gotten around to implement protobuf's and they're rocking my world. encoding is a fraction of the time, size is ~25% of equivalent JSON

now, I haven't un-packed anything, but how could that possibly go wrÄ‚‘ôØ3

hobbesmaster
Jan 28, 2008

karasu posted:

USB3 Bulk is just horrible without some kind of backpressure support or endless FIFO. I worked on a board that transferred about 220 MB/s and it had to use bulk (thanks USB3 Vision, why can't I use isochronous which is there for video ???).

Thing is, with bulk transfer Windows gives you the lowest priority to get rid of your data. Even just using the mouse or opening a browser would stop transfers for 10-20 miliseconds. Have fun compensating for that with FPGA SRAM. Isochronous transfers with enough reserved bandwith really help with that, especially with the data rate you're describing. But you do lose guaranteed packet delivery with it.

the USB video device class can actually work with high speed cameras and Windows seems prioritize it slightly higher. still no guarantees, which is a bit of a problem for a lot of machine vision applications

still need the ram

Sapozhnik
Jan 2, 2005

Nap Ghost
I wrote a firmware for a wirelessly-networked electricity meter, that was kinda fun

(not revenue-grade, it's for the customer's use, not the utility's)

so i got to continue my informal (wikipedia) education about electricity and electronics by reading up on like active power and apparent power & stuff like that (i already had a vague understanding of how impedance is represented using complex numbers so it was fairly straightforward)

this job is actually kinda fun the 10% of the time i'm doing the poo poo i was actually hired to do

movax
Aug 30, 2008

i'm itching to do something with a fpga

and it's been awhile since i've console nerded out

tell me about optical drive pickup assemblies

JawnV6
Jul 4, 2004

So hot ...
wrong answer

correct answer: dedicated twitch streaming box, hdmi in, rj-45 out

movax
Aug 30, 2008

JawnV6 posted:

wrong answer

correct answer: dedicated twitch streaming box, hdmi in, rj-45 out

oh god

i figure a zynq would be perfect for that though.

movax
Aug 30, 2008

i posted awhile back in the retro games thread about wanting to roll my own ps2 modchip for shits and giggles (and to figure out how they did it back in the day)

now i was recently thinking that if i could replace the optical pickup assembly in any given optical drive with a solid-state version, you can boot anything you want on the real hardware regardless of health of the wear item (laser)

i figure this will interest approximately 7.32 people so they can play their ps2 jrpgs until the end of time

JawnV6
Jul 4, 2004

So hot ...
oh doing THAT end of it

i thought you were emulating the host and wanted to control a drive, which seems a lot more complex/impossible

movax
Aug 30, 2008

JawnV6 posted:

oh doing THAT end of it

i thought you were emulating the host and wanted to control a drive, which seems a lot more complex/impossible

oh yeah, no -- that's what a couple of things do right now, but there's always that slight weirdness for one title or another (that comes from emulating a reverse-engineered interface)

i think the dreamcast was more or less atapi, but the ps1/ps2 in very japanese fashion have some hilarious large (probably like... .25um or larger) discrete asics that implement the drive controller (mechacon). studying the schematics i've found and the modchip install points, it looks like most chips hop onto some of the bios mask rom address/data lines, a couple of cs / oe lines and then a couple of pins on the mechacon

however, if you build something with a dac that emulates the signals a laser would normally transmit, then no one will ever be the wiser (i think) -- you take in the motor control and turn that into your clock, trigger e/f to have 'perfect focus', and then a/b/c/d as the data, but i can't find any good documentation on this poo poo.

JawnV6
Jul 4, 2004

So hot ...

movax posted:

i can't find any good documentation on this poo poo.

hold the phone... this sorta implies you've found good documentation on other poo poo??? where??

JawnV6
Jul 4, 2004

So hot ...
yeah step 1 sounds like you're collecting traces of a working system

so your FPGA is going to be a LA, connect all the right pins, 'watch' for a while on known inputs, then cut traces to the real components and start spoofing

movax
Aug 30, 2008

JawnV6 posted:

hold the phone... this sorta implies you've found good documentation on other poo poo??? where??

the schematic pdfs i have for the ps2 and ps1 are actually pretty loving amazing -- i don't know what cad package puts it out, or if it is a technical writing group but man it's hot

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

movax posted:

now i was recently thinking that if i could replace the optical pickup assembly in any given optical drive with a solid-state version, you can boot anything you want on the real hardware regardless of health of the wear item (laser)

there was a company that did something like this for a DVD jukebox to work around the CSS restrictions

their jukebox just returned the same bitstream as the drive to a DVD decoder mechanism, so their customers could rip DVDs that were indistinguishable to it from physical discs but not otherwise decoded

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
so yeah do you actually need an analog signal like would come in off the laser?

i bet that poo poo gets converted to bits awfully quickly, since the discs are digitally encoded, and that would give you a far better place to jump in

you could also probably look at the signals going to the motors, and figure out what specific bits it wants from that

JawnV6
Jul 4, 2004

So hot ...
wouldn't the motor have to be encoded too? there's no way they're controlled precisely enough, gotta be reading back position

where's the schematic, the intercept point is spread across a few different interfaces

movax
Aug 30, 2008

peep it:



i have the full pdf too, pm if you want it

movax
Aug 30, 2008

i think IC801 is a TI op-amp but i'm not sure. it's the first stage interface to the optical drive, and then it goes further to ic605 which is a sony cxd1869aq asic (cd/dvd dsp) coupled with cxp101064, another asic which is on mechacon duty. (aside, i wonder if there's a list of sony part prefixes somewhere). the dsp does the real nasty work of reading from discs.

the injection point is CN801. from what i have been able to find on how cd/dvd drives fuckin' work (greybeard heaven: http://www.repairfaq.org/REPAIR/F_cdfaq9.html#CDFAQ_009)
A, B, C, D -- focus / data signals
E, F -- tracking (potentially stupid simple to emulate since i will have perfect tracking / focus)
PD1, PD2 -- photodiode 1, photodiode 2 (laser diode?)
ABCD appear to be ac coupled

cn804 is the spindle motor connector, which i think i only need to use as an input to get an idea of where the host wants the target disc
H/H1/H2/H3/A1/A2/A3 -- drive motors and poo poo

i need to find a datasheet on IC801 but it is tough. ic802 is Rohm i think judging from the part number prefix (and the japanese love rohm). PD1/PD2/A-F I think are the set of high-bandwidth signals to generate into the RF amp, and then the 'control bus' is my input as to what it's asking for.

and can i reiterate again how loving nice these schematics are? absolutely miserable to print out i'm sure but beautiful on a screen

e:

movax fucked around with this message at 03:43 on Dec 12, 2015

Jerry Bindle
May 16, 2003
yeah thats a nice schematic, what is it done in? zuken?

movax
Aug 30, 2008

as a comparison, the ps1 uses the super common ksm-440aem opa:



different rf amp this time (that was probably in a fuckload of sony cd players), but slightly less signals since it's a CD only

still 2 PD signals, and only E and F out now. no A, B, C or D. spindle motor / sled motor is a separate connector

i'm like 15 years too late to this -- i tried searching TIs/etc websites for their marketing poo poo intended for optical drive makers in the 90s and i can't find it anywhere. bet they'd have reference designs that would be more than happy to show how to use their parts to build this.

Barnyard Protein posted:

yeah thats a nice schematic, what is it done in? zuken?

could be, i've heard good things about zuken.

movax
Aug 30, 2008

now that i'm kind of revisiting this project

(http://www.repairfaq.org/REPAIR/F_cdfaq1.html#CDFAQ_012)

(editor note: this poo poo is complex and economies of scale always blow my mind -- these things became loving ubiquitous)

using the ps1 rf amp as a reference --
* LD is laser diode output that uses Q701 and friends to power the actual laser diode inside the opa
* the PD pins are sense inputs, for what i'm not sure -- closed loop control of laser power, most likely.
*the actual reading element is essentially a quadrant detector i'm pretty sure -- the document says that focus is perfect when (A+C)-(B+D) = 0. i guess the ps1 may not be a 3-beam pickup system. E and F must be the only data coming out of the drive.

found a datasheet for the CXA2586 which is a photodiode ic for cd-rom / dvd-rom drives and it basically confirms that each photodiode output is a high-speed iv amplifier -- converts photocurrent to a voltage. runs off the supply rail of said pdic as well.

i think my block-diagram would be something like:
data store -> buffer -> FPGA -> serial DAC -> AFE -> connector

fpga handles taking raw iso data and applies efm to generate the appropriate signaling

data store being a SD card (probably), or if i use a zynq or something (oh god $$$), it could be anything and i dma it into fabric from ethernet/sd/usb/sata/what have you

e:


really need to get the datasheet(s) of the CXA2575N and SP3727ACA.

movax fucked around with this message at 04:25 on Dec 12, 2015

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull
how are you going to handle seeking, optical drives have some interesting stuff going on there which requires some kind of feedback in the data stream

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
so there's no tap where you can just inject a bitstream?

maybe you can work backwards a bit more to a point where things are digital

did PS2 Linux support the disc drive? maybe you could look at its driver and then just attach something to the CPU bus to emulate the registers/memory used to talk to the drive

movax
Aug 30, 2008

eschaton posted:

so there's no tap where you can just inject a bitstream?

maybe you can work backwards a bit more to a point where things are digital

did PS2 Linux support the disc drive? maybe you could look at its driver and then just attach something to the CPU bus to emulate the registers/memory used to talk to the drive

there is a tap where i could inject a bitstream; there's always the option of moving in layers and emulating different aspects of the interface, but there's some additional complexity there and additional risk of introducing weird one-off glitches because there's some game out there that expects certain timing behavior

BobHoward posted:

how are you going to handle seeking, optical drives have some interesting stuff going on there which requires some kind of feedback in the data stream

the way i understand it, there's only a couple of possible inputs to the drive to set position / read speed stuff, and that's the spindle motor speed, the tray position (sliding) and a tilt angle.

it looks like most of the amplifiers output tracking error and focus error signals too; if i can simulate zero tracking error and focus error, that might work -- but then again, some error might be expected because it (the actual dsp / controller) uses it as a control loop to figure out where on the disc it is vs. where it needs to be.

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

movax posted:

the way i understand it, there's only a couple of possible inputs to the drive to set position / read speed stuff, and that's the spindle motor speed, the tray position (sliding) and a tilt angle.

it looks like most of the amplifiers output tracking error and focus error signals too; if i can simulate zero tracking error and focus error, that might work -- but then again, some error might be expected because it (the actual dsp / controller) uses it as a control loop to figure out where on the disc it is vs. where it needs to be.

the control loop during a seek is what i was thinking of, iirc the drive tries to make an estimated seek movement, looks at the sector #, then makes a correction (which might be in the opposite direction), looks again, repeats until it hits a sector before and sufficiently close to the target sector of the seek, and then waits for it to arrive in the data stream

you have no idea what the target is so so you're gonna have to figure out some approach for feeding that control loop in such a way that it actually does the right thing in the end. sounds like a lot of fun (non ironic cool reverse engineering fun)

movax
Aug 30, 2008

BobHoward posted:

the control loop during a seek is what i was thinking of, iirc the drive tries to make an estimated seek movement, looks at the sector #, then makes a correction (which might be in the opposite direction), looks again, repeats until it hits a sector before and sufficiently close to the target sector of the seek, and then waits for it to arrive in the data stream

you have no idea what the target is so so you're gonna have to figure out some approach for feeding that control loop in such a way that it actually does the right thing in the end. sounds like a lot of fun (non ironic cool reverse engineering fun)

i just ordered a copy of 'dvd players and drives' from amazon for like $5 -- the google preview had some pretty good indications that the dude goes in depth about the details of the focus searching / tracking error stuff.

i think i detailed the pinout of the ps2 dvd-rom to myself in sufficient fashion as well:
code:
CN801				
Pin No.	Pin Name	Direction (relative to CN801)	Notes	TPs
1	PD	Output	Laser power feedback -- goes to IC801 pin 29. Shorted to CN801 Pin 21 and 30. Used for automatic control of laser diode power.	
2	GND	Input	GND	
3	VC	Input	1/2 VCC divided voltage (2.5V) -- sourced from IC801 Pin 26.	CL810 / JL827
4	G.SW	Input	Gain switch -- IC604, pin 37. Net 'GAIN_SW'.	CL268
5	D	Output	Photodiode D output. Voltage output varies based on whether disc is a CD or DVD.	CL812
6	A	Output	Photodiode A output. Voltage output varies based on whether disc is a CD or DVD.	CL813
7	PD1	Output	Sum of Photodiodes A+C. Used only for CDs (I think).	CL814
8	E	Output	Photodiode E output.	
9	M.SW	Input	Mode switch -- 'L' is CD, 'H' is DVD. IC604 Pin 36, IC606 Pin 4. IC604 is Mechacon, IC 606 is an analog switch.	
10	NC	Not Connected		
11	Cd-Lo	Input	CD Laser Diode Power. Driven by Q804 which is controlled by IC801 pin 28.	CL822
12	NC	Not Connected		
13	F	Output	Photodiode E output.	
14	PD2	Output	Sum of photodiodes B+D. Used only for CDs (I think).	
15	B	Output	Photodiode B output. Voltage output varies based on whether disc is a CD or DVD.	
16	C	Output	Photodiode C output. Voltage output vaires based on whether disc is a CD or DVD.	
17	VCC	Input	5V Supply. Current sourcing capability unknown.	
18	NC	Not Connected		
19	DVD-LD	Input	DVD Laser Diode Power. Driven by Q805 which is controlled by IC801 pin 27.	CL823
20	NC	Not Connected		
21	PD		Laser power feedback -- goes to IC801 pin 29. Shorted to CN801 Pin 1 and 30.	CL824
22	VR-DVD	Output	DVD photodiode current-limiting resistor return path. Controlled by Q801/Q802/Q803 inverter circuit based on state of M.SW (floating when CD is selected, GND when DVD selected). R is 100R.	
23	VR-CD	Output	CD photodiode current-limiting resistor return path. Controlled by Q801/Q802/Q803 inverter circuit based on state of M.SW (floating when DVD is selected, GND when CD is selected). R is 100R.	
24	NC	Not Connected		
25	TRK+	Input	Tracking Coil Driver (BA5815FM)	
26	TRK-	Input	Tracking Coil Driver (BA5815FM)	
27	FCS+	Input	Focus Coil Driver (BA5815FM)	
28	FCS-	Input	Focus Coil Driver (BA5815FM)	
29	NC	Not Connected		
30	PD		Laser power feedback -- goes to IC801 pin 29. Shorted to CN801 Pin 1 and 21.	CL827

there are several types of opas out there, but i think for cds, they use pd1 + pd2 + e + f as inputs, with the a/b/c/d summing done externally. i think the rf amps designed for dual format drives use pd1 + pd2 + a + b + c + d with pd1/pd2 still summed externally, but i think the dvd signal processing chain is done differently enough that the a/b/c/d raw inputs are needed.

i think in the end it all gets turned into the rf output which is all 1s and 0s (in both ac coupled and dc coupled form); i could maybe jump in there, but then soldering begins to be required instead of simple harnessing

so the input seeking commands i believe would be based on the tracking coil, focus coil, and sled movement (on a different connector) inputs, all of which are fed to the ba5815fm driver ic. i can probably put a small dummy coil load in place, feed that into an adc and use that in the digital domain to see what the drive controller thinks he's requesting.

for outputting simulated photodiode signals, the best option might actually be putting dummy diodes and outputting across them with a dac to generate the expected voltages. the PDIC inside the opa acts as a IV amplifier so maybe feeding an op-amp or diodes with a digital waveform may take care of my analog interface problems.

i'm only semi-concerned about the power-budget -- there's a 5V connection on the PS2, but i have no idea how much current it could source. i'd really love to make ethernet an option for this, but sd card is sadly probably the simplest method. with ethernet i'd have to deal with embedded tcp/ip stacks, and i'm cringing thinking of implementing stable smb/cifs/nfs support, unless i use something that can run linux, and now i need ddr and it's going to miserable and lovely. maybe a wifi module + bluetooth serial modem (for config via phone app) is the most user-friendly way of streaming content to this thing, in conjunction with a local sd slot 'just in case'.

e: the best part is i finally have a project to work on in the past few years that doesn't need to be concerned about radiation tolerance at all -- so every part is an option, hooray!

movax fucked around with this message at 22:23 on Dec 12, 2015

Spatial
Nov 15, 2007

cool, i didn't know these kinds of docs were out there

what's the "tilt driver" chip in the ps2 for? does the dvd drive need to know the console orientation to work?

movax
Aug 30, 2008

Spatial posted:

cool, i didn't know these kinds of docs were out there

what's the "tilt driver" chip in the ps2 for? does the dvd drive need to know the console orientation to work?

im pretty sure it's for tilting the optical drive sled / lens to improve focus and tracking accuracy, but not 100% sure

Bloody
Mar 3, 2013

this is a super cool idea

Jerry Bindle
May 16, 2003

Bloody posted:

this is a super cool idea

agreed

also i feel like a dipshit calling myself an embedded engineer while there are people fuckin around with stuff this complicated in their spare time. i mean good lord, the amount of time i wasted loving around with uarts

Bloody
Mar 3, 2013

nah embedded is so broad and dumb never feel like a dipshit

Bloody
Mar 3, 2013

there are huge tracts of embedded I know literally nothing about (amba /ahb/apb, rtos, anything bigger than a cortex m, hybrid fpga/mcu, plus a bazillion random other things) but still strongly identify as an embedded engineer. don't sweat it ever


remember: Toyota, a real actual successful company, has car firmware using literally over 5000 global variables to do stuff

Jerry Bindle
May 16, 2003
thanks for the perspective

hobbesmaster
Jan 28, 2008

on a small MCU all variables are global :v:

JawnV6
Jul 4, 2004

So hot ...
yeah "global" just means RAM

hobbesmaster
Jan 28, 2008

also I'm working with arm cortex a9 based systems and now and it feels like cheating

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

im thinkin about sticking a cpu core in my fpga because sending variable length strings over uart from verilog sounds like a horrendous pain in the rear end

  • Locked thread