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
Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

movax posted:

This sounds like a cool little firm to work with, how do you do business development?

Currently, we don't. Way overloaded with projects at this point. Mostly just client referrals or doing work for a client of a client so our primary client can sell them more stuff.

And last night the audio started glitching again. I'm going to have to see how to suspend alsa instead of continually streaming silence out.

E: since this is the embedded thread, my current fun project is heterogeneous computing. iMX7 is a pair of A9 cores and an M4. Shared memory, RTOS on the m4 side, linux on the main. Doing gyroscope acquisition as fast as it will go in the smaller core and feeding it into a filter before sending a smaller number of clean updates to the linux side.

Harik fucked around with this message at 20:38 on Nov 10, 2017

Adbot
ADBOT LOVES YOU

Tan Dumplord
Mar 9, 2005

by FactsAreUseless
Thanks for the recommendations. I've got a few options now I hadn't worked with before.

AVR32 has such lovely docs, I already hate working with it if only for that reason.

I work with PIC24s and like them pretty well. Decent docs.

NCO is for low-power no-interrupt waveform synthesis. It would be nice to see 2 on a chip, but the PICs top out at 1.

carticket
Jun 28, 2005

white and gold.

What sort of waveforms? Pretty much every timer will let you generate a square wave, though you may not be able to get a precise frequency.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
I once blue up a wall wart charger. I was using a DMM to test voltages at certain points to figure out where I could solder in a connection and accidentally shorted a lead. The thing blew up in my face with a huge bang that about gave me a heart attack as I shorted 120 V. The power went out at my work and everyone had a good laugh at my expense.

Another good one. Place I worked at we were an Intel certified partner (or something like that) so we would get new chips in months before commercial release. Intel still technically owned these chips and could request to have them back at any time and we were usually limited in how many we had. Well I got a board with one of these chips but no heat sink. One of the hardware engineers gave me a heat sink and I figured it's simple enough to screw down. The setup was a little wonky and I ended up over compressing the CPU with the heat sink and destroying it. That was fairly embarrassing.

sharkytm
Oct 9, 2003

Ba

By

Sharkytm doot doo do doot do doo


Fallen Rib
That reminds me of the old socket A athlon chips that had an exposed die and rocking the heatsink at all during install would chip the die and bye bye processor.

carticket
Jun 28, 2005

white and gold.

sharkytm posted:

That reminds me of the old socket A athlon chips that had an exposed die and rocking the heatsink at all during install would chip the die and bye bye processor.

My first PC build was a Thunderbird. I was so very cautious with that step.

Tan Dumplord
Mar 9, 2005

by FactsAreUseless

Mr. Powers posted:

What sort of waveforms? Pretty much every timer will let you generate a square wave, though you may not be able to get a precise frequency.

Linear frequency control and accuracy are key for the application.

EpicCodeMonkey
Feb 19, 2011
Has anyone implemented a ARM NEON fast reverse memcpy() before? I can find plenty of examples of vectorised memcpy(), but nothing that reversed the bytes from source to dest.

Basically, I'm looking for the fastest replacement for std::reverse_copy() I can get on a Zynq platform, since the DMA doesn't support negative increments.

carticket
Jun 28, 2005

white and gold.

I wonder if LDMIA/STMDA combos would be fast enough. That would only give you double word swapping, though.

E: looks like you could use VLDMIA !, VREV64.8 on each NEON register you're using, then VSTMDA !

You might be able to do something with the interleaved load/store, too. Like a VLD4.8, two VSWP, and then VST4.8 (it looks like you can't reorder the dest/src registers, so the VSWPs are required).

I'm going to go with something like this:

r0 = dst address
r1 = src address
r2 = size in bytes

add r1, r2
add r1, -32
copy:
vld4.8 {d0, d1, d2, d3} r1!
vswp d0, d3
vswp d1, d2
vst4.8 {d0, d1, d2, d3} r0
add r0, -32
add r2, -32
it eq
beq copy

Can probably clean up to be better than that. Worth looking at the performance of VLDM/VSTM with more VREV instructions versus more loop iterations with VLD4.8/VST4.8 and the VSWPs. The VSTM will also do the subtract of r0 for you.

E: might also be able to do something with the Q registers.

carticket fucked around with this message at 07:50 on Nov 18, 2017

EpicCodeMonkey
Feb 19, 2011

Mr. Powers posted:

I wonder if LDMIA/STMDA combos would be fast enough. That would only give you double word swapping, though.

E: looks like you could use VLDMIA !, VREV64.8 on each NEON register you're using, then VSTMDA !

You might be able to do something with the interleaved load/store, too. Like a VLD4.8, two VSWP, and then VST4.8 (it looks like you can't reorder the dest/src registers, so the VSWPs are required).

I'm going to go with something like this:

r0 = dst address
r1 = src address
r2 = size in bytes

add r1, r2
add r1, -32
copy:
vld4.8 {d0, d1, d2, d3} r1!
vswp d0, d3
vswp d1, d2
vst4.8 {d0, d1, d2, d3} r0
add r0, -32
add r2, -32
it eq
beq copy

Can probably clean up to be better than that. Worth looking at the performance of VLDM/VSTM with more VREV instructions versus more loop iterations with VLD4.8/VST4.8 and the VSWPs. The VSTM will also do the subtract of r0 for you.

E: might also be able to do something with the Q registers.

Awesome, that is for this! I'll give it a go Tuesday when I'm back in front of the kit. I'm an embedded C/C++ guy mainly who only does ASM when I have to, and haven't done ARM assembly before (I stuck to 8-bit devices in the past and ASM wasn't warranted on the huge 32-bit projects I worked on the last few years).

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

EpicCodeMonkey posted:

Has anyone implemented a ARM NEON fast reverse memcpy() before? I can find plenty of examples of vectorised memcpy(), but nothing that reversed the bytes from source to dest.

Basically, I'm looking for the fastest replacement for std::reverse_copy() I can get on a Zynq platform, since the DMA doesn't support negative increments.

I'm assuming you checked this before - but is there any reason you need to copy it in reverse instead of generating/parsing it in reverse?

I do things like pre-rotate all my sprites, coordinates and drawing so that the 90° screen rotation stride-memcpy is baked into the storage format and I don't eat it on every refresh.

EpicCodeMonkey
Feb 19, 2011

Harik posted:

I'm assuming you checked this before - but is there any reason you need to copy it in reverse instead of generating/parsing it in reverse?

I do things like pre-rotate all my sprites, coordinates and drawing so that the 90° screen rotation stride-memcpy is baked into the storage format and I don't eat it on every refresh.

Unfortunately, it's the display - it's mounted upside down and transposed, and the HW guys tell me it can't be changed (or SW reconfigured). I'm rendering into a frame buffer in a format the LCD can process directly.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

EpicCodeMonkey posted:

Unfortunately, it's the display - it's mounted upside down and transposed, and the HW guys tell me it can't be changed (or SW reconfigured). I'm rendering into a frame buffer in a format the LCD can process directly.

That's exactly the issue I have, except mine is turned 90° so my memcpy stride would be 4 bytes every 320*4. I just render everything to the framebuffer pre-rotated so the actual refresh is a straight linear DMA.

It's not that hard to render upside down, pre-rotated, pre-scaled, or pre-alpha blended, and it saves a lot of cycles when it comes time to hit the display.

carticket
Jun 28, 2005

white and gold.

I just get to use non-bad displays where I just flip two bits for a 180 degree rotation.

Just a note about the reverse copy stuff I gave: it all has pretty strict alignment requirements, so that may be a problem.

EpicCodeMonkey
Feb 19, 2011
Oh yes, we composite everything so that the final frame buffer is just streamed to the display as-is via a DMA.

The problem lies in the compositing - it's a 1920x1080 screen we need to draw various widgets to at 60 frames per second, transposed and upside down to match the final frame buffer. The sheer number of changing graphics, text and meters means any improvements in copying speed of our bare metal core has a noticeable impact on FPS.

carticket
Jun 28, 2005

white and gold.

EpicCodeMonkey posted:

Oh yes, we composite everything so that the final frame buffer is just streamed to the display as-is via a DMA.

The problem lies in the compositing - it's a 1920x1080 screen we need to draw various widgets to at 60 frames per second, transposed and upside down to match the final frame buffer. The sheer number of changing graphics, text and meters means any improvements in copying speed of our bare metal core has a noticeable impact on FPS.

You have a Zynq. I would just render the frame right-side up and have the FPGA engineers implement a reverse-DMA controller for you.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Speaking of Xilinx DMA, I'm about to lose my mind dealing with this scatter gather DMA engine. The FPGA guy was explaining it in more detail and he linked me to a bunch of older DMA version documents that had more detail in the operation. But it appears for multi-channel SG DMA Xilinx just tacked on a bunch of modules to their existing DMA logic and it's kind of a Frankensteins monster to parse.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Ahhh yes of course, if you want the DMA engine to continue running after reaching the end of the buffer descriptor chain you just have to set the end chain descriptor register value to a non buffer descriptor address (so that the compare of current to end descriptor location never matches). Never mind that the DMA driver automatically figures out the last buffer descriptors address and sets this register for you. So you either have to modify the drive or know to manually change this value to be something bogus.

JawnV6
Jul 4, 2004

So hot ...
Just set up the first scatter target as the end chain descriptor and have the DMA engine reprogram itself :2bong:

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

JawnV6 posted:

Just set up the first scatter target as the end chain descriptor and have the DMA engine reprogram itself :2bong:

:sbahj:

That's devious as heck

Kuule hain nussivan
Nov 27, 2008

I would like ro get into embedded programming, but don't want to spend a lot on boards and miscellanea. Are there any environments which are virtualized well?

hendersa
Sep 17, 2006

Kuule hain nussivan posted:

I would like ro get into embedded programming, but don't want to spend a lot on boards and miscellanea. Are there any environments which are virtualized well?

Well, what are you really trying to do? Keep in mind that embedded platforms tend to rely on the GPIO/SPI/I2C/PWM hardware that they interface with. You could virtualize much of an embedded platform, but without also virtualizing the hardware that the embedded platform interfaces with, you'll be a bit limited. Now, that being said, QEMU supports emulating a bunch of ARM platforms. You miss out on the adventures in getting the bootloader and such sorted out, but that's probably a big selling point to someone just starting out.

Honestly, I'd suggest just shelling out the $90 for a Raspberry Pi or BeagleBone Black starter kit, or $100 for the fancy Arduino kit, with all of the odds and ends. You're going to get a ready-to-go Linux distro with toolchains and libraries you can just apt-get and install on the RasPi/BBB and a lot of hardware components for experimenting with the Arduino.

I can understand having a limited budget, so emulating is QEMU is fine. But you're going to butt-up against the limitations of an emulated environment and you'll have to try and figure out what clever thing that you need to do to work around those limitations. You also miss out on plugging actual LEDs and such into your platform and interacting with them, which is most of the fun when working with an embedded platform.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
Yeah, don't emulate. Buy a few Arduino clones and an STM32F1 dev board for like $3 off eBay. You don't need to put a lot of money into this stuff anymore.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Something like a teensy 3.2 is fairly high powered, has good software support (works like an Arduino but more powerful) and costs $20. Programming is over USB.

carticket
Jun 28, 2005

white and gold.

I second the Teensy 3.2. We used one recently to rapid prototype a device at work. You can start with the Arduino environment and graduate to a C/C++ environment. Or you can dive right into C/C++. For debug facilities you need to modify the board, but I believe the 3.6 has SWD (ARM debug connection) test points or pins.

JawnV6
Jul 4, 2004

So hot ...
Is there a better thread for FPGA questions?

I have a spartan-6 board. I've downloaded ISE 14.7, done the stupid DLL swap to get it to run on Windows 10, now i have an example project I want to open that's from EDK. Can I open EDK projects? It failed on the first go but maybe there's additional steps to get it running on Win10. Could I just import the pcores into ISE?

Failing that, is there a modern FPGA with a free toolchain, HDMI in & out, and an Ethernet port?

carticket
Jun 28, 2005

white and gold.

The ZCU102 board has all that but it is still probably $2000 and the HDMI IP is licensed.

Also, BYO HDCP key.

JawnV6
Jul 4, 2004

So hot ...

Mr. Powers posted:

The ZCU102 board has all that but it is still probably $2000 and the HDMI IP is licensed.

Also, BYO HDCP key.
Or this for $500. I had my old FPGA, I've been watching speed runs and trying to get better at the Super Mario Darker Side run in general, was hoping I could just slap a twitch streaming box together instead of just buying a decent capture card :/

My other project is making my FLIR camera wireless and connected, was hoping some of the network streaming bits would come in handy for that one too.

carticket
Jun 28, 2005

white and gold.

If the FLIR is one of the Leptons or a FLIR One that you can take apart and remove the Lepton from, it's an I2C/SPI interface to the actual camera core, and you could use just about anything to make it wireless.

JawnV6
Jul 4, 2004

So hot ...
It's a lepton I won at a hackathon, we had a RPi talking to it over SPI. The kit came with an impressive little mounting board with a LCD screen and did the color-correction stuff, along with the module mount with the pin breakouts. I'm trying for something much smaller, got some knockoff ESP8266's that I *think* I can wrangle a SPI bus out of.
https://twitter.com/jawnv6/status/938450932395753472

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Here is a link to the schematic to your board, looks like you can get SPI.

https://nurdspace.nl/ESP8266#Schema

Looks like the PUY-P25Q is a flash part connected via SPI. There is an open chip select GPIO0 pin 15.

Switzerland
Feb 18, 2005
Do what thou must do.
Maybe wrong thread to ask, but I'm thinking of making my own watch, so would need something like stepper motor, a thing to program the logic (microcontroller?), and a battery.

I might be too dumb for microcontroller assembly/C, so I guess the next step up is something that allows JS/PHP/Python to run stepper motors? AND runs off a small battery?

And preferably flat & tiny, not gonna be making a watch that Woz wears to bed.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
What are your design goals? Accuracy? Battery form factor? Lifetime? Size?


If you scaled up and made a USB powered desk clock, I would have more confidence in your success. As it is, the problem I think you're describing is capital-H Hard.


Also, pick up an Arduino of some sort and get started with that. It uses C++ish, and I believe in you. You can learn a thing.

JS or anything other than c/c++ on embedded systems is still in novelty status, and will take more effort to learn the particulars than just doing it properly from the beginning.

Micropython / circuitpython are up and coming in that scene, though.

Switzerland
Feb 18, 2005
Do what thou must do.

ante posted:

What are your design goals? Accuracy? Battery form factor? Lifetime? Size?


If you scaled up and made a USB powered desk clock, I would have more confidence in your success. As it is, the problem I think you're describing is capital-H Hard.

Also, pick up an Arduino of some sort and get started with that. It uses C++ish, and I believe in you. You can learn a thing.

JS or anything other than c/c++ on embedded systems is still in novelty status, and will take more effort to learn the particulars than just doing it properly from the beginning.

Micropython / circuitpython are up and coming in that scene, though.

Goal: Make my own wearable watch, preferably one that *doesn't* look like some 2-inch thick, babby's first kit watch.

Accuracy: Doesn't have to be atomic-clock accuracy, all watches are imprecise, etc.

Battery form factor: Dependent on other components, but preferably something that'll last a month or longer.

Size: Apple watch-size

I'll see if I can learn a thing and start with a desk clock :)

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
For babby's first watch, more realistic goals would be losing maybe half a second per minute, ~2 hour runtime, and unless you're spinning your own PCB, pretty chunky. A desk clock is do-able, and will give you an idea of what you can expect for your next project :)

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

The cool part is that you can improve all those aspects of your project as you learn more.

csammis
Aug 26, 2003

Mental Institution

Switzerland posted:

Goal: Make my own wearable watch, preferably one that *doesn't* look like some 2-inch thick, babby's first kit watch.

You mentioned a stepper motor which makes me think you are thinking about a mechanical watch, and that is capital-H capital-ARD all-bold HARD. Hit up Youtube for watchmaker videos to get an idea of what you'd be in for. It's far more practical to start digital for sure.

quote:

Battery form factor: Dependent on other components, but preferably something that'll last a month or longer.

Depending on your component choices that might be reasonable, but for a battery the size of a wristwatch you just aren't looking at a zillion milliamp-hours. If you get to the point of choosing components we could help you figure out what power consumption would be in the worst case (tightening up power savings can get quite difficult) and that would give you a reasonable idea of what you'd be looking at.

quote:

I'll see if I can learn a thing and start with a desk clock :)

Great! I'm sure everyone here would love to help!

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer

ante posted:

For babby's first watch, more realistic goals would be losing maybe half a second per minute, ~2 hour runtime, and unless you're spinning your own PCB, pretty chunky. A desk clock is do-able, and will give you an idea of what you can expect for your next project :)

They make RTC chips for this purpose, so unless you're explicitly trying to only using a microchips internal clock just for difficulties sake then you would want to grab an RTC chip such as a MCP79410 or another I2C/SPI part (Maxim?). You'll also want a coin chip holster that will power your microchip/RTC and some sorta buck regulator.

If you go the RTC route which will be far more accurate than an internal micro clock you'll still end up losing probably seconds per-day so don't expect this too be a very accurate watch without regular updating.

Popete fucked around with this message at 07:30 on Mar 22, 2018

Le0
Mar 18, 2009

Rotten investigator!
Anyone works with LoRa here?
I'm looking for advice on what hardware to use for a small form sensor to be carried on a person and battery powered and a simple gateway concentrator module.

Adbot
ADBOT LOVES YOU

Switzerland
Feb 18, 2005
Do what thou must do.
Thanks again for the advice.

One question tho re: capital-H HARD - if it's hard, why has nobody come up with a small Arduino-ish thing that takes the hard out of "make your own mechanical-y watch"?

  • Locked thread