Commit Graph

95 Commits (34ef11630c2660bdb8643ebe7e87713944ab20c4)

Author SHA1 Message Date
Mahadevan Mahesh 316b859baf LPC: Move platform specific code out of the analog api file
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2017-07-20 13:16:06 -05:00
Mahadevan Mahesh 7d8b6d7684 LPC: Move platform specific code out of sleep api file
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2017-07-20 13:15:59 -05:00
Mahadevan Mahesh dfe2d3ba4c Add support for LPC54608
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2017-07-20 13:15:51 -05:00
Mahadevan Mahesh aee6f7b227 Add mbed support for LPCXpresso54114 board
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2017-07-20 13:15:36 -05:00
Martin Kojtal a7f9dc66b8 Fix #4613: remove duplicated startup files for MICRONFCBOARD
Inherits from LPC11U34_421, that defines startup. They were identical.
2017-07-13 17:03:29 +01:00
Martin Kojtal 10ea63b8e7 Ticker: add fire interrupt now function
fire_interrupt function should be used for events in the past. As we have now
64bit timestamp, we can figure out what is in the past, and ask a target to invoke
an interrupt immediately. The previous attemps in the target HAL tickers were not ideal, as it can wrap around easily (16 or 32 bit counters). This new
functionality should solve this problem.

set_interrupt for tickers in HAL code should not handle anything but the next match interrupt. If it was in the past is handled by the upper layer.

It is possible that we are setting next event to the close future, so once it is set it is already in the past. Therefore we add a check after set interrupt to verify it is in future.
If it is not, we fire interrupt immediately. This results in
two events - first one immediate, correct one. The second one might be scheduled in far future (almost entire ticker range),
that should be discarded.

The specification for the fire_interrupts are:
- should set pending bit for the ticker interrupt (as soon as possible),
the event we are scheduling is already in the past, and we do not want to skip
any events
- no arguments are provided, neither return value, not needed
- ticker should be initialized prior calling this function (no need to check if it is already initialized)

All our targets provide this new functionality, removing old misleading if (timestamp is in the past) checks.
2017-07-13 12:23:25 +01:00
Rob Meades fdf8a7980f Platform support for OnboardCellular modem and u-blox cellular interface drivers. This change allows the u-blox C027 and C030 boards to use both the mbed-os OnboardCellular modem driver and the u-blox cellular interface drivers (which support both PPP and AT data modes). 2017-06-15 14:32:09 +01:00
Russ Butler 805374ed89 Restore cmsis_nvic for Cortex-M0 targets
Restore cmsis_nvic (cmsis_nvic.c and cmsis_nvic.h) files for the
implementations which use a mechanism other than the VTOR to set
interrupts. These are vendor specific and were done for M0 devices
which do not have a VTOR.

Note - There were two cmsis_nvic files which did not use the VTOR that
which not restored in this patch. This is because these targets were
not M0 devices and could use the new unified implementation instead.
These files are:
targets\TARGET_ARM_SSG\TARGET_MPS2\TARGET_MPS2_M0P\device\cmsis_nvic.c
targets\TARGET_ONSEMI\TARGET_NCS36510\device\cmsis_nvic.c

Note - cmsis_nvic.c and cmsis_nvic.h were initial removed in
(and restored from) the commit:
b97ffe8fdc -
"CMSIS5: Replace target defined NVIC_Set/GetVector with CMSIS implementation"
2017-06-08 22:50:23 -05:00
Sam Grove 547320e99c Rename function st_rtc_localtime with _rtc_localtime 2017-06-07 23:24:48 -05:00
Vincent Coubard f880e44145 remove usage of mktime/localtime in favor of dedicated functions.
The use of mktime was causing a fault when called in interrupt handler because on GCC it lock the mutex protecting the environment, To overcome this issue, this patch add dedicated routine to convert a time_t into a tm and vice versa.
In the process mktime has been optimized and is now an order of magnitude faster than the routines present in the C library.
2017-06-07 22:06:22 -05:00
Sam Grove 5f138810a9 Merge pull request #4294 from ARMmbed/feature_cmsis5
Update CMSIS-Core and RTX to version 5
2017-06-02 23:44:32 -05:00
Martin Kojtal e229a49182 Merge pull request #4207 from geky/spi-remove-byte-locking
spi: Add SPI block-write to C++ and HAL for performance
2017-06-01 14:03:36 +02:00
Hasnain Virk 24de27c989 Major Refactoring & extensions
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a  future USBSerial etc.
ATParser becomes ATCmdParser.

* UARTSerial moves to /drivers

* APN_db.h is moved from platform to cellular/util/.

* Original CellularInterface is restored for backward compatability (again, supposedly there
  are users of that).

* A new file, CellularBase is added which will now servce as the base class for all
  upcoming drivers.

* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
  between an on-board or an off-board implementation.
  	- PPPCellularInterface is a generic network interface that works with a generic FileHandle
          and PPP. A derived class is needed to pass that FileHandle.
        - PPPCellularInterface provides some base functionality like network registration, AT setup,
          PPP connection etc. Lower level job is delegated to the derived classes and various modem
          specific APIs are provided which are supposed to be overridden.
        - UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
          passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
          In future we could proive a USBInterface that would derive from PPPCellularInterface and could
          pass the FileHandle back.
	- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
          the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
          a shield has to override the modem_init(), modem_power_up() etc as it cannot use
          onboard_modem_api.h.
2017-05-31 15:02:11 +03:00
Hasnain Virk ccbf00571f Introducing hal/modem_api.h
This provides a HAL layer for Modem bearing devices.
Provides a standard interface to upper layer drivers.
Platform providers will be implementing this API under their
specific targets.

As a reference, two implementations are provided under TARGET_C027 (UBLOX)
and TARGET_MTS_DRAGONFLY_F411RE (MultiTech).

targets.json now contains a tag "MODEM" which tells that this target
has a modem and the modem_api is protected by a flag DEVICE_MODEM
(following the DEVICE_SERIAL fashion ).
2017-05-31 15:02:11 +03:00
Hasnain Virk fcbcfafec5 Preparing grounds for modem api
* Lays down ground for mbed modem_api
* Standardizes pin names relating to modem device for UBLOX C027 and MTS_DRAGONFLY_F411RE
  devices
* Ublox modem api is changed to use a standard, platform independent name so that same
  api could be used with multiple ubloc modems.
* DCD Polarity macro is added to assist the driver in knowing correct polarity
2017-05-31 15:02:11 +03:00
Bartek Szatkowski 85cc9c8381 Remove deprecated RTX4 config options 2017-05-30 18:55:55 +01:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +01:00
Bartek Szatkowski b97ffe8fdc CMSIS5: Replace target defined NVIC_Set/GetVector with CMSIS implementation 2017-05-30 18:55:51 +01:00
Christopher Haster c1de19e49e spi: Added default spi_master_block_write implementation to all targets
There is an easy default implementation of spi_master_block_write that
just calls spi_master_write in a loop, so the default implementation
of spi_master_block_write has been added to all targets.
2017-05-25 12:04:58 -05:00
adustm 1fe20b281a Add can_init_frequency for NXP platforms 2017-05-15 14:27:22 +02:00
Bartek Szatkowski 2ddf4b33cb CMSIS5: Remove ARM7 support and targets 2017-05-12 13:48:43 -05:00
Brian Daniels a8bd3b2cb7 Removes FLASH capabilities for the ARCH_PRO.
This platform is failing a flash test at this time. This commit disables
the capability (and therefore the test) until it is fixed.
2017-05-10 15:16:22 -05:00
Anna Bridge 2d22db23db Merge pull request #4169 from 0x6d61726b/master
[NXP LPC176X] flash_api.c implementation
2017-05-04 15:41:17 +01:00
0x6d61726b 7d9e1d4b75 reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:16:52 +02:00
0x6d61726b 6c3f9bd485 reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:16:05 +02:00
0x6d61726b c2fa163322 reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:15:23 +02:00
0x6d61726b 6e46c7ad98 reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:14:58 +02:00
0x6d61726b 0125f9f1a1 reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:14:04 +02:00
0x6d61726b 131379aa0c reserved topmost 32 bytes of RAM used by IAP functions
NXP LPC176x/5x User Manual UM10360 Rev 4.1:
32.3.2.8 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack 
usage in the user allocated stack space is 128 bytes and it grows downwards.
2017-04-30 14:13:05 +02:00
Kevin Gilbert 83a510751b Added mapping to BTN-labelled switches 2017-04-28 11:31:48 -05:00
0x6d61726b 29c7b34dfa LPC176X flash_api.h implementation
For LPC176X (LPC1768/LPC1769) the flash driver has been implemented according to the CMSIS-PACK Keil.LPC1700_DFP.2.3.0 driver with the following changes in FlashPrg.c:
1. EraseChip() function removed (not used by flash_api)
2. Clock reconfiguration removed and clock value taken from function parameter to avoid unexpected behavior.

Full patch of FlashPrg.c:
--- Keil.LPC1700_DFP.2.3.0\Flash\LPC_IAP\FlashPrg_orig.c	2016-12-08 13:10:10.000000000 +0200
+++ Keil.LPC1700_DFP.2.3.0\Flash\LPC_IAP\FlashPrg.c	2017-04-11 20:02:37.000000000 +0200
@@ -191,90 +191,15 @@
  *                    fnc:  Function Code (1 - Erase, 2 - Program, 3 - Verify)
  *    Return Value:   0 - OK,  1 - Failed
  */
 
 int Init (unsigned long adr, unsigned long clk, unsigned long fnc) {
 
-#if defined LPC1XXX  || defined LPC11U6X
-  CCLK       = 12000;                          // 12MHz Internal RC Oscillator
+	CCLK = clk / 1000;                           // CCLK value is in kHz, clk in Hz
 
-  MAINCLKSEL = 0;                              // Select Internal RC Oscillator
-  MAINCLKUEN = 1;                              // Update Main Clock Source
-  MAINCLKUEN = 0;                              // Toggle Update Register
-  MAINCLKUEN = 1;
-//  while (!(MAINCLKUEN & 1));                   // Wait until updated
-  MAINCLKDIV = 1;                              // Set Main Clock divider to 1
-
-  MEMMAP     = 0x02;                           // User Flash Mode
-#endif
-
-#ifdef LPC17XX
-  IAP.stat =  0;                               // Note: Some Bootloader versions don't set the status if this command is executed
-  IAP.cmd  = 54;                               // Read Part ID
-  IAP_Call (&IAP.cmd, &IAP.stat);              // Call IAP Command
-  if (IAP.stat) return (1);                    // Command Failed
-
-  switch ((IAP.res[0] >> 24) & 0xFF) {
-    case 0x25:
-                                               // Part ID LPC1759 = 0x25113737
-                                               // Part ID LPC1758 = 0x25013F37
-                                               // Part ID LPC1756 = 0x25011723
-                                               // Part ID LPC1754 = 0x25011722
-                                               // Part ID LPC1752 = 0x25001121
-                                               // Part ID LPC1751 = 0x25001118 / 0x25001110
-    case 0x26:
-                                               // Part ID LPC1769 = 0x26113F37
-                                               // Part ID LPC1768 = 0x26013F37
-                                               // Part ID LPC1767 = 0x26012837
-                                               // Part ID LPC1766 = 0x26013F33
-                                               // Part ID LPC1765 = 0x26013733
-                                               // Part ID LPC1764 = 0x26011922
-      CCLK  =  4000;                           //  4MHz Internal RC Oscillator
-      break;
-    case 0x27:
-                                               // Part ID LPC1778 = 0x27193F47
-                                               // Part ID LPC1777 = 0x27193747
-                                               // Part ID LPC1776 = 0x27191F43
-                                               // Part ID LPC1774 = 0x27011132
-                                               // Part ID LPC1772 = 0x27011121
-    case 0x20:  // found out during test
-    case 0x28:
-                                               // Part ID LPC1788 = 0x281D3F47
-                                               // Part ID LPC1787 = 0x281D3747
-                                               // Part ID LPC1786 = 0x281D1F43
-                                               // Part ID LPC1785 = 0x281D1743
-    case 0x48:                                 // Part ID LPC4088 = 0x481D3F47
-    case 0x47:                                 // Part ID LPC4078 = 0x47193F47
-                                               // Part ID LPC4076 = 0x47191F43
-                                               // Part ID LPC4074 = 0x47011132
-      CCLK  = 12000;                           // 12MHz Internal RC Oscillator
-      break;
-    default:
-      CCLK  =  4000;                           //  4MHz Internal RC Oscillator
-  }
-
-  CLKSRCSEL = 0x00;                            // sysclk = IRC
-
-  PLL0CON  = 0x00;                             // Disable PLL (use Oscillator)
-  PLL0FEED = 0xAA;                             // Feed Sequence Part #1
-  PLL0FEED = 0x55;                             // Feed Sequence Part #2
-
-  switch ((IAP.res[0] >> 24) & 0xFF) {
-    case 0x27:                                 // LPC177x
-    case 0x20:                                 // LPC178x
-    case 0x28:                                 // LPC178x
-    case 0x48:                                 // LPC407x
-    case 0x47:                                 // LPC408x
-      CCLKSEL  = 0x01;                         // use Sysclk devided by 1 for CPU
-      break;
-    default:
-      CCLKSEL  = 0x00;                         // CPU clk divider is 1
-  }
-
   MEMMAP   = 0x01;                             // User Flash Mode
-#endif
 
   return (0);
 }
 
 
 /*
@@ -283,37 +208,12 @@
  *    Return Value:   0 - OK,  1 - Failed
  */
 
 int UnInit (unsigned long fnc) {
   return (0);
 }
-
-
-/*
- *  Erase complete Flash Memory
- *    Return Value:   0 - OK,  1 - Failed
- */
-
-int EraseChip (void) {
-
-  IAP.cmd    = 50;                             // Prepare Sector for Erase
-  IAP.par[0] = 0;                              // Start Sector
-  IAP.par[1] = END_SECTOR;                     // End Sector
-  IAP_Call (&IAP.cmd, &IAP.stat);              // Call IAP Command
-  if (IAP.stat) return (1);                    // Command Failed
-
-  IAP.cmd    = 52;                             // Erase Sector
-  IAP.par[0] = 0;                              // Start Sector
-  IAP.par[1] = END_SECTOR;                     // End Sector
-  IAP.par[2] = CCLK;                           // CCLK in kHz
-  IAP_Call (&IAP.cmd, &IAP.stat);              // Call IAP Command
-  if (IAP.stat) return (1);                    // Command Failed
-
-  return (0);                                  // Finished without Errors
-}
-
 
 /*
  *  Erase Sector in Flash Memory
  *    Parameter:      adr:  Sector Address
  *    Return Value:   0 - OK,  1 - Failed
  */
2017-04-11 21:03:45 +02:00
Willie Walker ad074b5a22 Add SCL and SDA defs for I2C[0-2]; redefine I2C_[SCL,SDA] to I2C2 2017-03-31 16:32:45 -04:00
Rob Meades 965404c09e Construct a ticker-based wait, rather than calling wait_ms(), in the C027 board startup code since, for mbed 5, wait_ms() is an RTOS function and the RTOS is not initialised at this stage in start-up. 2017-03-22 15:15:06 +00:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
Sam Grove 15cbf6628e Merge pull request #3621 from JojoS62/fix-lpcxpresso-clock
Fix for #2884, LPC824: export to LPCXpresso, target running with wron…
2017-02-09 09:30:05 -06:00
JojoS 9b8ac9b4e5 Fix for #2884, LPC824: export to LPCXpresso, target running with wrong clock speed
SystemInit() was called condititionally, but necessary defines were not
set in mbed. Calling SystemInit() unconditional now.
Removed also conditiional calls to legacy CodeRed lib.
2017-01-20 17:04:27 +01:00
Bartek Szatkowski 6a045a49a9 Platform: Add sleep/deepsleep user facing functions
Add sleep/deepsleep functions to platform layer which are replacing HAL
functions with the same name, rename existing symbols in HAL layer
to hal_sleep/hal_deepsleep. This way sleep functions
are always available, even if target doesn't implement them, which makes
the code using sleep clearer. It also enables us to make decision on in
which builds (debug/release) the sleep will be enabled.
2017-01-19 09:39:29 +00:00
Sam Grove 10b6dbf839 Merge pull request #3504 from CalSol/canfixes
[LPC15xx] CAN implementation improvements
2017-01-09 10:18:43 -06:00
Richard Lin 14d579ad50 Fix && -> & typo 2017-01-02 01:47:43 -08:00
Richard Lin 9a8cd059f8 Ensure that PWM=1 is resolved correctly 2016-12-24 23:20:56 -08:00
Richard Lin fd24700c50 Add TX, EW, EP, BO interrupts; allow reset to clear a bus-off condition 2016-12-24 01:51:55 -08:00
micromint aede0fc6f3 Fix default polarity on LPC43XX PWM driver 2016-11-10 13:00:34 -04:00
Peter Harliman Liem b3e5c97244 Fix wrong index at LPC43xx tx end ring assignment
NUM_TX_FRAG should be used instead of NUM_RX_FRAG
2016-10-28 22:48:37 +08:00
Christopher Haster 26ced98734 restructure - Restructured cmsis directory
targets/cmsis -> cmsis
targets/cmsis/TARGET_* -> targets/TARGET_*/device
targets/cmsis/TARGET_*/mbed_rtx.h -> targets/TARGET_*/mbed_rtx.h
2016-10-04 17:51:44 -05:00
Christopher Haster 0bad622a16 restructure - Moved targets out to top level
hal/targets -> targets
hal/targets.json -> targets/targets.json
2016-09-30 19:18:09 -05:00