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
BattleMaster
Aug 14, 2000

Popete posted:

I'm looking into options for a project I'm working on using an Atmega328. I'd like to have some sort of on board storage (NAND or NOR Flash maybe?) to store off data. Is this feasible for a small micro like the AVR Megas? What overhead and requirements am I looking at? If you guys have suggestions on interfaces or even devices to recommend that would be awesome. I don't need a lot of storage, but something persistent.

Sounds like you want a serial EEPROM. Microchip makes many of them (link). Many microcontrollers including the Atmega328 have I2C and/or SPI peripherals, and interfacing only requires 2 pins and 2 pull-up resistors (I2C) or 4 pins (SPI). With the interface done in hardware and with a simple small pin count interface it isn't much work to add such a thing to your project.

Also the specs for the Atmega328 show it as having 1024 bytes of on-chip EEPROM so you may as well use that instead if it's enough.

BattleMaster fucked around with this message at 08:59 on Feb 9, 2015

Adbot
ADBOT LOVES YOU

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Besides the on-chip EEPROM, I think the Atmegas have an API for using portions of the flash as data space if you need a little more room

TheresaJayne
Jul 1, 2011
I tried a program over the weekend,

I have an arduino Uno,
Pin 9 - Servo connection (also connected to +5 and gnd on appropriate wires)
Pin 1 - connected to +5 via Switch (do i need a resistor on this)
Pin 2 - connected to +5 via switch (do i need a resistor on this)

The premise, on reset - servo goes to pos 0
press pin1 (and hold) servo goes to pos 180
now it just waits until pin2 goes high then back to pos 0

The final setup will be for a locking box, when the lid closes it triggers pin 1 locking the box until the reed switches hidden somewhere on the case connected in serial are all correct (ie NSNSSNSNSS code)
(pin2) to unlock the box so you can open it resetting the connection and the operation.

Unfortunately it wasn't working at all on the breadboard.

can anyone see any problems with my sketch?

code:
#include "Servo.h"

Servo servo;

boolean locker;
int servoPos;
int pinRead;
void setup()
{
  locker = false;
  pinMode(1,INPUT);
  pinMode(2,INPUT);
  servo.attach(9);
  servoPos = 0;
  servo.write(servoPos); //Set to unlock position
}

void loop()
{
  if(locker == false)
  {
    pinRead = digitalRead(1);
    if (pinRead == HIGH)
    {
      servoPos = 180;
      locker = true;
      servo.write(servoPos);                                    
    }
  }
  else
  {
    pinRead = digitalRead(2);
    if(pinRead == HIGH)
    {
      servoPos = 0;
        servo.write(servoPos);
      delay(20000);
    }
  }
}

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

BattleMaster posted:

Sounds like you want a serial EEPROM. Microchip makes many of them (link). Many microcontrollers including the Atmega328 have I2C and/or SPI peripherals, and interfacing only requires 2 pins and 2 pull-up resistors (I2C) or 4 pins (SPI). With the interface done in hardware and with a simple small pin count interface it isn't much work to add such a thing to your project.

Also the specs for the Atmega328 show it as having 1024 bytes of on-chip EEPROM so you may as well use that instead if it's enough.

Perfect, I thought I had seen I2C interfaced eeproms before for this ORT of thing. I forgot I also had some on chip storage. Not sure that alone will be enough though.

My Rhythmic Crotch
Jan 13, 2011

TheresaJayne posted:

I have an arduino
Try this thread

Tiger.Bomb
Jan 22, 2012

Blotto Skorzany posted:

Besides the on-chip EEPROM, I think the Atmegas have an API for using portions of the flash as data space if you need a little more room

Of course, how else would the bootloader work to support usb flashing? ;)

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 asked in the Electronics thread but figured I'd throw it up here.

Does anyone know of a service that will place BGA components? I have an idea for a design using a Freescale K70, possibly with an eMMC both are BGA. I would need a service that does small (even single board) placement.

Potassium Problems
Sep 28, 2001
I'm not sure if this is the right place to ask, but I'm having some issues working with the LUFA library. I'm basically attempting to register a custom built device (currently 8 buttons hooked up to an ATMega8u2) as a USB keyboard, which works. I can get buttons to act like keyboard keys /w modifiers, but the problem is attempting to send multimedia scan codes, like mute, vol up/down, etc. I think I have to add a consumer page to my HID descriptor, but I'm still coming up empty. I based it on the KeyboardMouseMultiReport demo, only swapping the Mouse descriptors for the Consumer descriptor found in the MediaController demo and sending back either a keyboard or media report, but nothing seems to be working.

Here's a gist of my HID descriptor, the extra keyboard report is for being able to send a set feature report to map buttons to different keyboard scancodes. The actual code is in a private repo, but I'll see if it's cool to open it up.

taqueso
Mar 8, 2004


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

:pirate::hf::tinfoil:

Popete posted:

I asked in the Electronics thread but figured I'd throw it up here.

Does anyone know of a service that will place BGA components? I have an idea for a design using a Freescale K70, possibly with an eMMC both are BGA. I would need a service that does small (even single board) placement.

Advanced Assembly will do small runs like that, but you will pay handsomely for it. I bet there is a hobbiest level service somewhere, as in some guy on a forum with a DIY reflow oven, but I don't actually know of one.

BattleMaster
Aug 14, 2000

BGA packages were made by someone who seriously dislikes humanity. The only package that is more hateful is flip-chips.

Arcsech
Aug 5, 2008

Popete posted:

I asked in the Electronics thread but figured I'd throw it up here.

Does anyone know of a service that will place BGA components? I have an idea for a design using a Freescale K70, possibly with an eMMC both are BGA. I would need a service that does small (even single board) placement.

I haven't used these guys, I only found out about them just recently through OSHPark's twitter, but it seems like what you're looking for: http://www.smallbatchassembly.com/

Their FAQ posted:

Surface Mount Minimum Sizes

0603, QFNs, BGAs are OK w/minimum .5mm pitch

carticket
Jun 28, 2005

white and gold.

BattleMaster posted:

BGA packages were made by someone who seriously dislikes humanity. The only package that is more hateful is flip-chips.

BGAs are wonderful when you get to pin counts above 64 on small boards. Even then, you can get a 5x5 part with 64 balls and very little keep out around it, or a slightly larger QFN with some keep out, or a QFP that is gargantuan in comparison.

Edit: also package size is a big cost driver, so a 200 pin QFP is going to cost much more than a 256 ball BGA that is physically smaller.

BattleMaster
Aug 14, 2000

Mr. Powers posted:

BGAs are wonderful when you get to pin counts above 64 on small boards. Even then, you can get a 5x5 part with 64 balls and very little keep out around it, or a slightly larger QFN with some keep out, or a QFP that is gargantuan in comparison.

Edit: also package size is a big cost driver, so a 200 pin QFP is going to cost much more than a 256 ball BGA that is physically smaller.

I don't doubt their advantages, as their advantages are why they exist and why people put up with them. But they're so terrible to have to work with.

EpicCodeMonkey
Feb 19, 2011

Lone_Strider posted:

I'm not sure if this is the right place to ask, but I'm having some issues working with the LUFA library. I'm basically attempting to register a custom built device (currently 8 buttons hooked up to an ATMega8u2) as a USB keyboard, which works. I can get buttons to act like keyboard keys /w modifiers, but the problem is attempting to send multimedia scan codes, like mute, vol up/down, etc. I think I have to add a consumer page to my HID descriptor, but I'm still coming up empty. I based it on the KeyboardMouseMultiReport demo, only swapping the Mouse descriptors for the Consumer descriptor found in the MediaController demo and sending back either a keyboard or media report, but nothing seems to be working.

Here's a gist of my HID descriptor, the extra keyboard report is for being able to send a set feature report to map buttons to different keyboard scancodes. The actual code is in a private repo, but I'll see if it's cool to open it up.

Sorry, I haven't had much time to respond to all the pending tickets on the public support mailing list lately.

Your HID descriptor looks ok from a quick glance, so I suspect it's the code in the HID callbacks that is the issue. Can you post a gist of your CALLBACK_HID_Device_CreateHIDReport() function implementation?

Potassium Problems
Sep 28, 2001
Sure, here's Keyboard.c and for good measure, Keyboard.h

evensevenone
May 12, 2001
Glass is a solid.
This might be stretching the limits of this thread, but anyone have any experience with Yocto or similar "embedded" Linux distributions? My work has a fairly decent-sized project that runs on what have become basically headless linux boxes that run Debian, but I'd like to further automate the process of building install images (right now we just install everything to the physical device and dd the boot drive, then install to other devices off that, but it's kinda time consuming). I'd like to get it to a point where building the image could be 100% automated and hooked into CI.

My Rhythmic Crotch
Jan 13, 2011

In a doozy of a corporate merger, NXP and Freescale will be merging to form one uber-entity. Most interesting to me will be the impact on toolchains, IDEs and headers/libs as both companies had a pretty good push towards open source. Hopefully that trend will continue.

carticket
Jun 28, 2005

white and gold.

I wonder if NXP's AMP CM4/CM0 will become a Vybrid.

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'm kinda pumped for NXP/Freescale. We use a lot of Freescale stuff at work so it'll be cool to see some new toys at some point.

Kinda kicking myself I didn't buy into Freescale awhile back though :(

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

Popete posted:

I'm looking into options for a project I'm working on using an Atmega328. I'd like to have some sort of on board storage (NAND or NOR Flash maybe?) to store off data. Is this feasible for a small micro like the AVR Megas? What overhead and requirements am I looking at? If you guys have suggestions on interfaces or even devices to recommend that would be awesome. I don't need a lot of storage, but something persistent.

What others have been telling you about using the flash as data storage is definitely true. Just to expand on it a bit - those chips have three distinct (and separately copy-protectable with fuses) regions of flash, the application region, app table region, and bootloader. The app table region lets you get away from having to deal with your code size as you continue development possibly expanding into your data and they meant it for things like sine tables, but it sounds like it'll do what you need.

Word of warning though, it takes a really long time to execute a flash write. So don't do this anywhere remotely near things that are timing dependent.

http://www.nongnu.org/avr-libc/user-manual/pgmspace.html should help you in your quest.

evensevenone
May 12, 2001
Glass is a solid.
Also watch out, because flash can only be erased on a sector by sector basis, and i'm guessing that the AVR only has the three sectors (bootload, application, and program data) and they aren't subdivided further. So you can write, but if you want to change anything, you need to erase the whole thing.

movax
Aug 30, 2008

evensevenone posted:

This might be stretching the limits of this thread, but anyone have any experience with Yocto or similar "embedded" Linux distributions? My work has a fairly decent-sized project that runs on what have become basically headless linux boxes that run Debian, but I'd like to further automate the process of building install images (right now we just install everything to the physical device and dd the boot drive, then install to other devices off that, but it's kinda time consuming). I'd like to get it to a point where building the image could be 100% automated and hooked into CI.

It's pretty slick -- at my last job I maintained a simple Linux distro (as a hardware engineer) using Buildroot -- got the job done effectively.

At current job, we use Yocto -- it's more "softwarey" and a pain in the rear end in my opinion, but sure as hell, the SW guys have it hooked into the build system as just one more component that gets built. It's a bit heavier weight in term of infrastructure, but it's certainly more flexible than Buildroot.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Not a big fan of BitBake being a horrible abomination of make, bash and python, but oh well

BattleMaster
Aug 14, 2000

evensevenone posted:

Also watch out, because flash can only be erased on a sector by sector basis, and i'm guessing that the AVR only has the three sectors (bootload, application, and program data) and they aren't subdivided further. So you can write, but if you want to change anything, you need to erase the whole thing.

I don't know much about AVRs but I don't think that's exactly the case. For PICs the flash is erased in blocks of 64 bytes, so I would be surprised if AVRs didn't have a similar level of granularity.

Lord Windy
Mar 26, 2010
I've been given an Atmel324a by my University in a circuits course. Most people are using the AVR Studio (could be called Atmel), but it doesn't run on Macs and I don't want to use VMware to run it.

With some difficulty, I managed to get a C compiling and flashing no issues through AVRDude and gcc-avr. I found a decent Makefile for it. But most of my course is in AVR Assembly and I cannot work out how to compile it and flash it over.

My current compiling is:

avr-as -mmcu=atmega324a -o blah.elf blah.as
avr-objcopy -j .text -j .data -O ihex blah.elf blah.hex
avrdude -F -P usb -c stk500v2 -p m324pa -U flash:w:main.hex:i

For C, it is:

avr-gcc -Wall -Os -DF_CPU=20000000 -mmcu=atmega324a -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=20000000 -mmcu=atmega324a -o main.elf main.o
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size --format=avr --mcu=atmega324a main.elf
avrdude -F -P usb -c stk500v2 -p m324pa -U flash:w:main.hex:i

And just comparing the code I may have discovered my problem. I didn't do an avr-size...

EDIT: Nope, still not working. HOW STRANGE!

2ndEdit:

code:
RESET:	clr r16
		out 0x01, r16
		ser r17
		out 0x07, r17
		jmp LOOP
		
LOOP:	in r16, 0x00
		com r16
		out 0x08, r16
		jmp LOOP
Is my code

EDIT3:

I am a twit, it appears it is my code that is at fault. I just did the most basic thing, set all of C outputs to 1. But I cannot work out what I did wrong.

Lord Windy fucked around with this message at 07:51 on Apr 23, 2015

yippee cahier
Mar 28, 2005

Does avr-gcc support creating a .elf from an .o like second command in your list of C commands? You may need to specify a linker script or linker options to create an ELF file.

I only use arm-none-eabi-gcc, so I don't think I can be of more help.

yippee cahier fucked around with this message at 02:14 on Apr 25, 2015

Lord Windy
Mar 26, 2010
I probably should have posted a result, I worked it out.

It still seems absurdly large for what the program is, having exploded from 22bytes to 170bytes, but it appears to work.

code:
.global main
main:	clr r16
		out 0x01, r16
		ser r17
		out 0x07, r17
		jmp loop		
loop:	in r16, 0x00
		com r16
		out 0x08, r16
		jmp loop
avr-gcc will compile asm as cpp if you name it blah.S, and then you just need to add in .global main. When I get back to class on Monday I'll experiment more, but at the moment it is working better than I hoped.

yippee cahier
Mar 28, 2005


Good to hear. You can probably get the compiler to dump intermediate assembler to see why it got so big. My guess is some of the functionality listed here: http://nongnu.org/avr-libc/user-manual/mem_sections.html.

EpicCodeMonkey
Feb 19, 2011

Lord Windy posted:

It still seems absurdly large for what the program is, having exploded from 22bytes to 170bytes, but it appears to work.

Likely you'll be paying the C run-time start-up cost (some loops to zero-fill parts of memory, load constant zero into r0, etc), plus the size of the fixed vector table which is flash based and occupies the first bunch of flash locations (see the datasheet). Remember that the first entry in the fixed vector table (location 0) is the reset vector, and runs when the chip starts. If you aren't using interrupts yet you don't need to add an explicit RJMP to your start function in the vector table and fill the rest of the vector table with RET instructions, but it might be worth doing so now for later on.

yippee cahier
Mar 28, 2005

Ok, work is getting less exciting and I want to keep learning new things. At work we use FreeRTOS on top of Atmel Software Framework. While it's nice the hardware and low level libraries are maintained, contributing back and getting answers to bug reports is a slow process, and then it's Atmel only. I'd like to contribute to a project in the same vein that might be used by more people. You know, write a few drivers for an already defined HAL or something like that. mbed is looking pretty good because it's pan-ARM Cortex-M, but maybe there are some better projects out there. What's the general consensus?

I'm also looking to get a little better at the debugging hardware side of things. I have an Olimex JTAG probe working with openocd, but is there a newer, cooler probe I should be using? I see there seems to be some mention of CMSIS-DAP around, is it worth looking into?

Lord Windy
Mar 26, 2010

EpicCodeMonkey posted:

Likely you'll be paying the C run-time start-up cost (some loops to zero-fill parts of memory, load constant zero into r0, etc), plus the size of the fixed vector table which is flash based and occupies the first bunch of flash locations (see the datasheet). Remember that the first entry in the fixed vector table (location 0) is the reset vector, and runs when the chip starts. If you aren't using interrupts yet you don't need to add an explicit RJMP to your start function in the vector table and fill the rest of the vector table with RET instructions, but it might be worth doing so now for later on.

A little bit of overhead isn't too bad, I have (I think) 16k of instruction (2byte blocks) space.

We're going to make a game, I imagine some form of pong given the parts we have. An 8x16 LED board and a little 4 or 8 axis joystick. The whole setup is rather nice, the University made custom breadboards and cpu boards. The sort that should be impervious to crap that we can do. Like when I plugged two VCCs into a NAND chip.

bobua
Mar 23, 2003
I'd trade it all for just a little more.

Not sure if this is the best place for this, so feel free to point me towards another thread...


I want a pretty specialized device. ~13mp image sensor with a buffer of about 5 seconds(150 frames), powered by poe and controllable over ethernet with passive cooling.

I was looking at something like the minnowboard with a poe breakout adapter and a usb 3.0 camera, but it's tough to get answers from companies selling sensors that large about SDK's. I'm wondering how hard it is to put something like this together around a board level camera sensor. Will I need a phd in electrical engineering? I have the trdb-d5m from terasic sitting on my desk, and it's existence is what gave me the idea that it might be doable, but I've barely touched an fpga besides blinking an led on a dev kit.

Right now I'm using $2000 a piece industrial cameras in the 2mp range, and jumping up to even 5mp would run me closer to 6 or 7 thousand a piece, so that's sort of the 'is it worth it' umbrella I'm under.

JawnV6
Jul 4, 2004

So hot ...

bobua posted:

I was looking at something like the minnowboard with a poe breakout adapter and a usb 3.0 camera, but it's tough to get answers from companies selling sensors that large about SDK's.

In my opinion, you need something as integrated as a usb3.0 camera, and I'd be shocked to find a driver for that available on a minnowboard. I've had image sensor reps point me at other distributors, they weren't interested in dev kit level things. Atmel and others have boards that are meant to show off other features that you might be able to leverage: http://www.atmel.com/tools/sam4s-wpir-rd.aspx

If 5MP is enough you can get the RPi camera module. It & the board should fit under the 15w poe.

Back of the envelop math tells me 150 frames of 13MP is ~2GB of data. So you'd need a board with 4GB of RAM for a solution meeting that spec.

Aurium
Oct 10, 2010
Speaking of leveraging dev kits

https://www.youtube.com/watch?v=ylDgJi-hi_k
http://www.e-consystems.com/13MP-MIPI-Camera-nvidia-Jetson-TK1.asp

13MP at 14 fps.

It doesn't meet passive cooling requirement as it comes, but you could potentially swap in a different cooling solution.

bobua
Mar 23, 2003
I'd trade it all for just a little more.

JawnV6 posted:

In my opinion, you need something as integrated as a usb3.0 camera, and I'd be shocked to find a driver for that available on a minnowboard. I've had image sensor reps point me at other distributors, they weren't interested in dev kit level things. Atmel and others have boards that are meant to show off other features that you might be able to leverage: http://www.atmel.com/tools/sam4s-wpir-rd.aspx

If 5MP is enough you can get the RPi camera module. It & the board should fit under the 15w poe.

Back of the envelop math tells me 150 frames of 13MP is ~2GB of data. So you'd need a board with 4GB of RAM for a solution meeting that spec.

I don't actually need to full 13mp, I need the width.

I only need about 1500-2000 pixels of vertical resolution, so I would be setting the region of interest on the sensor way down. Even the width on 13mp would probably be more than I need.

I have a tegra dev kit, think I'll try and get a hold of that 13mp sensor. I've just never really done fpga\board layout\integration so I don't know what sort of job I'm biting off. Will I be dragging and dropping existing components or learning to write vhdl for this sort of thing?

JawnV6
Jul 4, 2004

So hot ...
I haven't worked with one personally but the Tegra board is a CUDA platform, not FPGA? If you're just grabbing the board and modifying the provided demo, you shouldn't have any layout concerns. It should just be a pure SW effort at that point.

I wouldn't try to route MIPI signals around outside of a packaged demo kit like that. It's just I2C with some extra lines for all the data. But those extra lines are differential signaling, can ramp up to something stupid like 1+ Gbps, you essentially need a DMA engine on the other side to shuffle the data hose around. If I'm understanding the kit that Aurium linked all of that is solved, you plug things in and write SW.

And if you need 2000 pixels of vertical resolution turn the sensor on its side.

bobua
Mar 23, 2003
I'd trade it all for just a little more.

Sorry, I meant if I went the more custom device route...

poe power, gigabit ethernet, some sort of frame buffer\controller, plus the actual sensor. Was thinking I'd get a nice fpga dev kit that has pretty much all that on it already, get it working, then lay out my own board. I've never done anything like that, so I was wondering if that was a huge undertaking.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS

bobua posted:

I was wondering if that was a huge undertaking.

Yeah

yippee cahier
Mar 28, 2005

As I'm sure you're already aware by your use of industrial cameras, you can often configure a region of interest and get faster readout as you can skip the top and bottom lines and transmit less back to your host. You might be able to get away with a small/cheaper sensor if that's the case.

This topic made me remember about this video:
https://www.youtube.com/watch?v=yhUO673YgJg

Adbot
ADBOT LOVES YOU

Hadlock
Nov 9, 2004

sund posted:

As I'm sure you're already aware by your use of industrial cameras, you can often configure a region of interest and get faster readout as you can skip the top and bottom lines and transmit less back to your host. You might be able to get away with a small/cheaper sensor if that's the case.

This topic made me remember about this video:

I counted no fewer than three ponies on his PCBs

  • Locked thread