Commit Graph

1046 Commits (864a9b83e52d45b1657f4a55607bef9993090488)

Author SHA1 Message Date
Anders Lindvall d8935bb837 Misc fixes for LPC4088/LPC4088DM:
- Resetting in LPCXpresso IDE did not reset the LCD controller which
  sometimes could cause strange behaviour
- The ROM_LAT bit in the MATRIXARB register must be set in order to
  prevent a HardFault when debugging
- The change of compiler in LPCXpresso IDE to ARM launchpad GCC5 was
  causing build errors due to multiply defined timeval symbol.
- The exporters for LPCXpresso IDE did not set the FPU_PRESENT define
  for assembler, only for c/c++. This caused very strange behaviour
  in the RTOS code (e.g. timeouts no longer working, context switches
  failing etc.)
2016-05-30 10:50:17 +02:00
adustm 86fe75cb9b [STM32F3] Use USART3_BASE instead of UART3_BASE
This change allows the use of UART3 instance.
This change fixes the following issue :
https://developer.mbed.org/questions/4937/Serial-problem-no-Tx-to-PB_10
It's been validated on NUCLEO_F302RB, for PB_9 and PB_10 pins
2016-05-30 10:14:35 +02:00
Sam Grove b2f2075fc2 correct indentation from tab to space 2016-05-28 19:03:22 +08:00
Sam Grove 284bd081b4 Remove __enable and __disable irq calls from mbed hal common code 2016-05-28 17:19:55 +08:00
Sam Grove d2fd820e13 Merge pull request #1806 from c1728p9/dev_critical_use
Use critical section helper in HAL
2016-05-28 13:39:28 +08:00
Russ Butler 3055b2881c Merge pull request #1805 from sg-/move-target-json
move target description from tools into hal where the target code lives
2016-05-28 00:17:25 -05:00
Kevin Bracey 4422884c16 Use critical section helper in HAL
Routines using __disable_irq and __enable_irq had the effect of
enabling interrupts if called with interrupts disabled.

Some versions of __disable_irq do not return old status to restore it.

Change to use the critical section helper functions instead.
2016-05-28 00:04:20 -05:00
Sam Grove d94627e042 move target description from tools into hal where the target code lives 2016-05-28 12:46:08 +08:00
Anna Bridge 462c917ad0 Add a c based re-entrant critical section API
This includes a generic critical section implementation.  This
implementation also allow a user to start a critical section while
interrupts are already disabled.
2016-05-27 23:27:52 -05:00
Sam Grove 60c862c206 Merge pull request #1795 from 0xc0170/dev_mbedos_additions
Small changes (docs plus assert)
2016-05-28 09:02:04 +08:00
Russ Butler 48fd7d7480 Compatibility changes
Make changes to improve compatibility:
-Include toolchain.h inside mbed.h
-define EXTERN
2016-05-27 10:34:19 -05:00
Jimmy Brisson e690ec0fc5 moved event_callback_t for compatibility with many drivers 2016-05-27 10:28:46 -05:00
Christopher Haster fbbda73faa Update Callback to fix fault in serial interrupts
per @c1728p9

Update the Callback class to handle a NULL thunk by returning 0
rather than trying to call the thunk.  This fixes a crash that occurs
on some targets when the TX uart handler is not attached.

Background:
The K64F HAL uart implementation calls the TX interrupt handler
every time a uart interrupt occurs while the TX register is empty.
It does not check to see if the TX interrupt has been enabled.
This means that the TX interrupt can and typically does get
run on RX events.  This causes a crash with the newer callback
code which did not (prior to this patch) support a NULL thunk.
2016-05-27 10:28:46 -05:00
Christopher Haster a7f4262858 Adopt Callback class in hal 2016-05-27 10:28:46 -05:00
Christopher Haster 2e112f535a Add backward compatiblity for FunctionPointer class using Callback
effectively:
typedef Callback<R(A)> FunctionPointerArg1<R,A>
typedef Callback<R()> FunctionPointerArg1<R,void>
typedef Callback<R()> FunctionPointer
typedef Callback<R()> event_callback_t
2016-05-27 10:28:45 -05:00
Christopher Haster 15db3951df Add Callback, an improved FunctionPointer class
- Adopt C++11 style template arguments, requires rename to Callback
- Add constructor for C style callback functions
- Add constructor for Callbacks
- Add static function for passing to C style callbacks
2016-05-27 10:28:45 -05:00
0xc0170 04e4c6a880 k64f - mac address - fix warnings - get UID via K64F SIM macros 2016-05-27 15:00:39 +01:00
0xc0170 709f479093 hal - adding doxygen documentation
The most doxygen docs are taken from ARMmbed/mbed-hal module.
2016-05-27 13:08:45 +01:00
0xc0170 985255dbb5 assert - use fprintf (if serial=1) and mbed_die 2016-05-26 15:36:32 +01:00
0xc0170 d898c11e42 api - doxygen improvements, unused parameters fixes
This patch is taken from mbed-drivers master.
2016-05-26 15:07:57 +01:00
0xc0170 ea72444c96 mbed lib revision - 121 2016-05-25 09:57:29 +01:00
0xc0170 f7b629664d HAL - nordic Lib folder back
It was removed with hal/rtos rearrangement.
2016-05-25 09:57:26 +01:00
Adam Green 61e2296037 Fix NXP LPCxxxx i2c_start() handling of repeated start
In repeating start scenarios, there was a bug in the I2C driver for
various NXP LPCxxxx parts which could allow an extra I/O from the
previous operation to leak through. The scenario I encountered which
triggered this bug went like so:
* The higher level application code would first do an I2C write that
  doesn't send a stop bit (use repeating start instead.)
* The higher level application code would then issues an I2C read
  operation which begin with a call to i2c_start().
* i2c_start() would clear the SI bit (interrupt flag) at the top of
  its implementation.
* i2C_start() would then get interrupted right after clearing the SI
  bit.
  * While the CPU is off running the ISR code, the I2C peripheral
    repeats the last byte written to I2CDAT and then sets the SI bit to
    indicate that the write has completed.
  * The ISR returns to allow the i2c_start() to continue execution.
* i2c_start() would then set the STA bit but it is too late.
* i2c_start() waits for the SI bit to be set but it is already set
  because of the completed byte write and not because of the repeated
  start as expected.

For me this bug would cause strange interactions between my ISRs and
the code using I2C to read from the MPU-6050 IMU. I would be getting
valid orientation data and then all of a sudden I would start receiving
what looked like random values but I think it was just reading from the
incorrect offset in the device's FIFO.

It appears that atleast one other person has seen this before but it
was never root caused since it required specific timing to reproduce:
  https://developer.mbed.org/forum/bugs-suggestions/topic/4254/

This bug can be found in most of the NXP I2C drivers and this commit
contains a fix for them all. I however only have the LPC1768 and
LPC11U24 for testing.

My fix does the following:
* No longer clears the SI bit in the i2c_conclr() call near the
  beginning of the i2c_start() function. It was this clear that
  previously caused the problem as described above.
* The second part of the fix was to instead clear the SI bit after
  the STA (start) bit has been set with the i2c_conset() call.
* The clearing of the SI bit should be skipped if there isn't an
  active interrupt when first entering i2c_start(). If you clear
  the SI bit when there isn't an active interrupt then the code
  is likely to skip over the interrupt for the start bit which was
  just sent and then allow the I2C peripheral to start sending the
  slave address before it has even been loaded into the I2CDAT
  register.
2016-05-25 00:20:06 -07:00
0xc0170 b32f7a9aaf Merge branch 'TomoYamanaka-master_branch2' 2016-05-24 13:27:32 +01:00
0xc0170 935111ff6c Merge branch 'master_branch2' of https://github.com/TomoYamanaka/mbed into TomoYamanaka-master_branch2 2016-05-24 11:30:26 +01:00
Martin Kojtal 24136afd3f Merge pull request #1763 from BartSX/timer-fxxx-#816
Fix timer #816 issue for STM32F0 and STM32F1
2016-05-24 11:26:43 +01:00
0xc0170 39fa25d77e Merge branch 'ksitko-master' 2016-05-23 15:48:12 +01:00
Martin Kojtal 045d99bbaa Merge pull request #1764 from BartSX/can-devel-f0
[STM32F0xx] Move CAN API to new directory structure
2016-05-23 15:40:52 +01:00
Bartosz Szczepanski aa2ecad0b2 [STM32F0xx] Move CAN API to new directory structure
We need to remove *can_api.c* file accordingly to new directory structure.
Without that we can't compile any CAN mBed test.

Change-Id: I3d4f798ad75ec1b4c4a1d7ed877e71b7db6bf60f
2016-05-23 16:30:25 +02:00
0xc0170 62eda4dd6d Merge branch 'master' of https://github.com/ksitko/mbed into ksitko-master 2016-05-23 15:22:23 +01:00
0xc0170 9c525e2f71 Merge branch 'master' of https://github.com/toyowata/mbed into toyowata-master 2016-05-23 15:06:09 +01:00
Bartosz Szczepanski 01ff0b9ab7 [NUCLEO_F030R8] 16-bit timer register update
This path fixes issue #816.

Current value of TIM_MST->CNT is read in interrupt context only.
This avoids master timer overflow without SlaveCounter update.

Change-Id: I8e2ec02ce7539a4c044c7e3dfe6bedc9fcdf7736
2016-05-23 16:02:25 +02:00
Bartosz Szczepanski 82d82d0b2a [NUCLEO_F070RB] 16-bit timer register update
This path fixes issue #816.

Current value of TIM_MST->CNT is read in interrupt context only.
This avoids master timer overflow without SlaveCounter update.

Change-Id: Iaaf7b9eb33aa8d8992e9354ca5e21bf01ec2413d
2016-05-23 16:02:25 +02:00
Rafal Kula e938780788 [NUCLEO_F103RB] 16-bit timer register update
This path fixes issue #816.

Current value of TIM_MST->CNT is read in interrupt context only.
This avoids master timer overflow without SlaveCounter update.

Change-Id: Ie7a9bfce76990f85caa84264450d053604af33e5
2016-05-23 16:02:25 +02:00
Rafal Kula 07b841b08f [STM32Fxxx] Fix issue #816
Both STM32F0xx and STM32F1xx are using a 16-bit timer as a internal ticker
but the mBed ticker needs a 32-bit timer implementation, so the upper part
of that 32-bit timer is being calculated in software.

Software bug has been fixed where continous HIGH/LOW voltage levels
could be observerd for 65ms due to 16-bit timer overflow.

Now current value of TIM_MST->CNT is stored in cnt_val and is
updated in interrupt context only. This avoids master timer
overflow without SlaveCounter update.

This fix is only for platforms which already implements a 16-bit timer:
F103RB, F070RB, F030R8

Change-Id: I205c70ce155b373c6593ead93ade9ec38993f7f9
2016-05-23 16:02:25 +02:00
Bartosz Szczepanski f1c42bfc69 [NUCLEO_F302R8] Added CAN support
Added CAN API support for NUCLEO_F302R8 target.

*stm32f302x8.h* file was changed to avoid compilation errors.

Change-Id: Ia4ee8a90fe3f0ad6955dde21e78ea4a6c05e4fcd
2016-05-23 15:55:00 +02:00
Bartosz Szczepanski 347a5e629d [NUCLEO_F303K8] Added CAN support
Added CAN API support for NUCLEO_F303K8 target.

*stm32f303x8.h* file was changed to avoid compilation errors.

Change-Id: If093c84f19c5a5ef68938af4653a25271c1108ba
2016-05-23 15:55:00 +02:00
Bartosz Szczepanski 9a78b010a0 [NUCLEO_F303RE] Added CAN support
Added CAN API support for NUCLEO_F303RE target.

*stm32f303xe.h* file was changed to avoid compilation errors.

Change-Id: Ia6519c982261d43165dbce73cab7cfc0617474e2
2016-05-23 15:55:00 +02:00
Bartosz Szczepanski 656d1953d9 [NUCLEO_F334R8] Added CAN support
Added CAN API support for NUCLEO_F334R8 target.

*stm32f334x8.h* file was changed to avoid compilation errors.

Change-Id: Ic7b3273ffe24940ecdc189d2566a6a7f66825ce6
2016-05-23 15:55:00 +02:00
0xc0170 ee6f510ade Merge branch 'fix_f4_serial' of https://github.com/bcostm/mbed into bcostm-fix_f4_serial 2016-05-23 14:08:19 +01:00
0xc0170 2b44bfbcc6 Merge branch 'timer-l0-#816' of https://github.com/BartSX/mbed into BartSX-timer-l0-#816 2016-05-23 13:59:40 +01:00
Bartosz Szczepanski 78767491f7 Added CAN API for STM32F3xx family
* STM32F3xx family have only one CAN bus

Change-Id: Icaed8ff8ca4a68ebbf2c124655e7368423fb71cd
2016-05-23 14:39:51 +02:00
0xc0170 c70aedc044 Merge branch 'can-devel-f0' of https://github.com/BartSX/mbed into BartSX-can-devel-f0 2016-05-23 10:37:22 +01:00
0xc0170 f3e11eb36e semihost - fix inline __semihost for IAR (add static)
This was causing errors at my machine (for programs like MBED_10, RTOS_1):

Error[Li005]: no definition for "__semihost" [referenced from
          semihost_api.o(mbed.a)]
[ERROR] Error[Li005]: no definition for "__semihost" [referenced from
          semihost_api.o(mbed.a)]
2016-05-23 09:50:20 +01:00
Mihail Stoyanov ec8512aaab Removed mbed-drivers/mbed.h which breaks compatibility with binary releases due to difference in the inclusion path 2016-05-23 09:14:06 +01:00
Mihail Stoyanov d9734e5a32 Simplify layout:
* /libraries/mbed -> /hal
* /libraries/rtos -> /rtos
2016-05-23 09:13:59 +01:00