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
robostac
Sep 23, 2009
As far as I'm aware CMSIS doesn't really make that possible. It provides interfaces to the common cortex functionality (interrupts, debug, systick, base clocks), but any extra peripherals are completely different.

The STM libraries extend CMSIS to give you access to the STM peripherals, but you couldn't switch to another manufacturers chip without rewriting all your peripheral code (or even switch between some STM families - the STM32F2 library is quite different to the STM32F1 library).

This seems to be an issue with all arm chips. While the core is identical (so in theory code written for one cortex device should run on any cortex device), there aren't standards for peripherals, so every chip has to have it's own device libraries.

Adbot
ADBOT LOVES YOU

robostac
Sep 23, 2009
I'm not aware of any way you could multiplex the slave select pin (beyond switching between two devices on a single pin and using an inverter for one). SPI works by having a single device active if it's select pin is low, and if two devices were active you'd just end up with corrupt data.

Regarding CMSIS - even if you did make UART0 on one chip match UART0 on another, I'd expect the internal registers to be incompatible as well, so you end up needing to rewrite most of the peripheral code. I guess it wouldn't be hard to write some standard functions to do this for switching between specific boards, but it's something you'd have to write rather than being included as part of CMSIS.

robostac
Sep 23, 2009

Martytoof posted:

Oh I hadn't even thought of that issue. That alone makes prescalers more sensible. Thanks!

They can also be quite useful for making the counter / period values be in a certain unit (eg at 84mhz a prescaler of 84 means the counter will be in microseconds). We've got one of the 32 bit timers constantly running at this rate so the counter register can be directly used as a source for timestamps, and it avoids the overhead of having interrupts trigger to update variables. It can also be easier to understand a timer with a period of 1000 to trigger every millisecond instead of a period of 840000.

robostac
Sep 23, 2009
STM provide IAP examples (http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257903), which accept code over USART, program it into flash and run it. You could modify this to use a different way of getting the data, and making it store the binary and then run from ram wouldn't be a problem either. It might work better than the built in thing.

robostac
Sep 23, 2009

Kire posted:

Has anybody ever used gdb for debugging a target from a host machine? I'm just curious, I learned about it in a class and it sounds complicated since gdb's command line interface gets very difficult to use very quickly, since terminals cannot display as much info as a GUI. So cross-debugging on a target seems really confusing, but kind of neat.

If you don't like command line debugging, there are a lot of gui's that can use GDB as a backend (I use eclipse).

robostac
Sep 23, 2009

Joda posted:

Is there any way to avoid the redundancy, while also having the life span in the program memory?

While not helpful for the more generic question, in this case couldn't you just set lifeTime to LIFE_SPAN in the constructorand decrement it in the update function and mark it as dead when it reaches 0?

robostac
Sep 23, 2009

Slanderer posted:

Wireshark on linux might support USB capture, so give that a try? There might be capture software for Windows too. There are also inline USB protocol analyzers and data loggers, but those can be expensive.

Microsoft Message Analyzer is quite good (and free) for windows USB capture.

There are a few libusb ports for windows (eg libusbK) that will let you send / recieve to USB endpoints without writing a driver, which might be a good way to get started.

The first step should be connecting the device and getting the descriptors to see if it's going to be a standard usb class or a completely custom thing. USBView (either the microsoft version or the improved USBTreeView - http://www.uwe-sieber.de/usbtreeview_e.html#download) is good for this.

Adbot
ADBOT LOVES YOU

robostac
Sep 23, 2009

RICHUNCLEPENNYBAGS posted:

I set up Microsoft Message Analyzer but I feel like kind of a dummy in that I can't figure out which USB traffic actually belongs to this device. But maybe that's not the right tack anyway.

The best way I've found is to set a filter for the vendor / product id. In your case this would be:
code:
(Microsoft_Windows_USB_USBPORT.Fid_USBPORT_Device.IdVendor == 0x0B9A) and
(Microsoft_Windows_USB_USBPORT.Fid_USBPORT_Device.IdProduct == 0x0800)

  • Locked thread