summaryrefslogtreecommitdiff
path: root/src/stm
Commit message (Collapse)AuthorAge
* Merge branch 'telescience-v0.2'Keith Packard2013-02-24
|\
| * altos: Crank fast SPI on STM to 8MHzKeith Packard2013-01-13
| | | | | | | | | | | | | | With the GPIO pins set to 10MHz now, we can run SPI at the maximum possible speed (8MHz). Signed-off-by: Keith Packard <keithp@keithp.com>
| * altos: Set STM GPIO output speed for SPI pins correctlyKeith Packard2013-01-13
| | | | | | | | | | | | | | | | The GPIO pin settings affect the output impedence, and hence the maximum speed for SPI. Cranking these to suitable values allows SPI to run at full speed. Signed-off-by: Keith Packard <keithp@keithp.com>
| * altos: Initial telescience bitsKeith Packard2013-01-12
| | | | | | | | | | | | These might do something, and should at least bring up USB Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos/stm: Add more bits to NVIC register definitionsKeith Packard2013-02-24
|/ | | | | | This cleans up a few values, adds more comments and a few more NVIC fields. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add support for 115200 baud serial ratesKeith Packard2012-11-30
| | | | | | Necessary for flashing skytraq chips Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make stdio 8-bit clean by making pollchar return intKeith Packard2012-11-30
| | | | | | | | | | We were stealing one value (0xff) in the return value from pollchar to indicate 'not ready yet'. Instead of doing that, use the integer value -1 and have pollchar return an int instead of a char. That necessitated cleaning a few other bits to make sure that 0xff wouldn't get promoted to -1 on accident. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Support LEDs on multiple portsKeith Packard2012-11-01
| | | | | | | Split out the bits in a fairly simplistic fashion so that we support no more than 16 LEDs still. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Provide ao_task_alarm_tick to reduce per-tick costKeith Packard2012-10-26
| | | | | | | Cache the next wakeup time and check that before jumping to the task code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Leave interrupts disabled while checking for task to runKeith Packard2012-10-26
| | | | | | | Otherwise, we run the risk of an interrupt waking a task after we've decided to idle the CPU. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up stm arch macros a bit.Keith Packard2012-10-25
| | | | | | | Turn a bunch of the macros into inline functions. Clean up the reboot method to use the stm_scb structure. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Switch drivers to ao_arch_block/release_interruptsKeith Packard2012-10-25
| | | | | | Stop using cli/sei, which are avr-specific Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add task queues.Keith Packard2012-10-25
| | | | | | | | | This replaces the array-based scheduler with a queue-based one instead. It should have the same basic scheduling semantics, but it walks shorter lists for each operation, making it much more efficient when the system has a lot of tasks. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add stack-guard code. Uses STM MPU to trap stack overflow.Keith Packard2012-10-25
| | | | | | | | This marks the lowest portion of the stack as inaccessible to the CPU, causing the processor to fault when it reaches it. The fault then generates a panic message so that the user can know what happened. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Replace __critical usage with ao_arch_critical as neededKeith Packard2012-10-25
| | | | | | | | | | | | | sdcc offers __critical as a machine-independent way to block interrupts, but as gcc doesn't, we need to use a compiler-independent construct instead. ao_arch_critical has been around since the AVR port, but some old __critical usages remained. This fixes a bunch of random hangs when communicating with MM over USB or the radio as the various stdio loops were running without interrupts blocked between the test and the sleep. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: profiling on STM32LKeith Packard2012-10-25
| | | | | | Add sample-based profiling, using a 1kHz timer Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Force beep timer regs reload when enabling beeperKeith Packard2012-10-25
| | | | | | | Without this, there can be a long delay between asking for the beeper and having it actually start sounding. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Stop spewing clock out PA8 pinKeith Packard2012-10-21
| | | | | | | This was used to debug the clock bringup, but is not useful anymore, and probably a bad idea to boot. Signed-off-by: Keith Packard <keithp@keithp.com>
* Merge branch 'master' into mm-ms5611Keith Packard2012-10-18
|\ | | | | | | Signed-off-by: Keith Packard <keithp@keithp.com>
| * altos/stm: Declare all SPI bus speedsKeith Packard2012-10-15
| | | | | | | | | | | | Just list them all so users can pick what they like Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos: Go back to recording sensor data in globalsmm-ms5611Keith Packard2012-10-08
| | | | | | | | | | | | | | | | Instead of trying to get things into the ring from a variety of functions, go back to the simpler method of storing them in globals and having the ADC code just pluck out the most recent values. Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos/stm: Set SPI clock high for disabled SPI bussesKeith Packard2012-10-06
| | | | | | | | | | | | | | This should avoid an accidental low->high transition when switching between multiple SPI busses. Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos/stm: Clean up SPI pin configuration codeKeith Packard2012-10-06
|/ | | | | | | Make sure none of the pin configurations are being used at startup time. Split out the pin configuration into separate functions. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Fix basic time interval to 10ms -- was 10.1msKeith Packard2012-09-09
| | | | | | Counting from 0 to 100 takes 10.1ms, so count to 99 instead. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Oops. forgot ao_data.cKeith Packard2012-08-28
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Explicitly erase memory in STM eeprom driver.Keith Packard2012-08-28
| | | | | | This seems to make the STM32L152 happier Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fix ao_delay function and move from per-chip code to ao_task.cKeith Packard2012-08-28
| | | | | | | ao_delay hasn't been chip-specific for a long time, and it had a bug in not calling ao_clear_alarm. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Enable STM SYSCFG when routing EXTIKeith Packard2012-08-28
| | | | | | | The EXTI routing information is in the syscfg unit, so that needs to be powered up or writes to its registers will be lost. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: No need to initialize EXTI priorities at startup timeKeith Packard2012-08-28
| | | | | | They all get set to the correct value when enabled. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Expose a signed version of the tick countKeith Packard2012-08-27
| | | | | | Useful when doing time comparisons. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Provide interface for STM LCD driver.Keith Packard2012-08-27
| | | | | | | | This provides a simple function interface for driving the LCD segments in the STM chip. It also uses the update complete interrupt to block LCD users during flush. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Trigger sample complete when all data are readyKeith Packard2012-08-26
| | | | | | | This has each sensor mark a bit in the current data record which is then sent for processing when all of the data are present. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Shrink STM stack sizeKeith Packard2012-08-26
| | | | | | 512 bytes should be enough for anybody. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Allow STM SPI bus on multiple pin setsKeith Packard2012-08-18
| | | | | | | | This allows multiple STM pin groups to be used for each SPI bus. Useful for the MS5607 sensor which signals conversion complete on the MISO line. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add button driver and event queueKeith Packard2012-08-06
| | | | | | | With this, a single task can wait for any button or quadrature input device. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add ao_gpio_get and ao_exti_set_modeKeith Packard2012-08-06
| | | | | | Needed to support general GPIO interrupts Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add driver for STM internal flashKeith Packard2012-07-29
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add software AES implementationKeith Packard2012-07-29
| | | | | | This is untested Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Place STM config values at fixed addresses for re-useKeith Packard2012-07-17
| | | | | | | | Just like cc1111, stick the serial number and radio calibration values at known fixed addresses so that when re-flashing the board, we can go find the existing values. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make ao_tick_count visibleKeith Packard2012-07-16
| | | | | | | Necessary to fetch it when interrupts are already disabled as we can't call ao_time then. Signed-off-by: Keith Packard <keithp@keithp.com>
* src: Add explicit 'pin' argument to ao_enable_outputKeith Packard2012-07-14
| | | | | | | This lets the cc1111 use the atomic bit operation instead of a mask, which is immune to interrupt issues as well as being a shorter code sequence. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Expose ao_gpio_set which sets a specific GPIO pinKeith Packard2012-07-14
| | | | | | Will need versions for other architectures Signed-off-by: Keith Packard <keithp@keithp.com>
* stm: running out of memory in MM -- reduce stack to 668 bytesKeith Packard2012-07-14
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Force STM stack to start at the top of RAMKeith Packard2012-07-14
| | | | | | | Using a fixed size means crashing if there's not enough space for that, or wasting memory if there's too much. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Increase default STM stack to 648 bytesKeith Packard2012-06-27
| | | | | | | 512 seems cozy given the printf implementation we're using and the extensive interrupts. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up STM I2C clock computationsKeith Packard2012-06-27
| | | | | | Fix both clock time and rise time. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: get MPU6000 I2C link working reliablyKeith Packard2012-06-27
| | | | | | | | | | This slows the i2c bus to 100kHz (yuck), sets the rise time to spec (it was way off) and adds more delays during bus setup. I've run this for hours now without trouble. Will try to adjust things back to fast mode and see if I can make that work as 100kHz isn't fast enough to reliably get data at 100 samples/sec. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: reorder stm USB state stores to avoid racesKeith Packard2012-06-27
| | | | | | | | | | | | | Must set ao_usb_in_pending before telling USB about new data or an interrupt could arrive at the wrong time to clear it. Same for ao_usb_in_flushed. Without these changes, I've seen the USB bus lock up on occasion, waiting for an IN packet to consume data, but with no IN data pending in the hardware. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: include targe SPI speed in get requestKeith Packard2012-06-27
| | | | | | | STM needs it to be provided when enabling the SPI device, so just fix AVR and cc1111 to do the same. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Wait for i2c START condition before setting interrupt bitsKeith Packard2012-06-27
| | | | | | | | This seems better than the random loop that it replaces, but I still have no idea why this is required; it doesn't coorespond to the docs at all... Signed-off-by: Keith Packard <keithp@keithp.com>