Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge common files between LPC11XX and LPC11CXX #79

Closed
wants to merge 4 commits into from

Conversation

omdathetkan
Copy link
Contributor

Remaining differences now are

  • device.h (DEVICE_CAN 0/1)
  • pwmout_api.c (Assuming that these need to be the same, see below)
  • PeripheralNames.h (The same after pwmout_api.c is resolved)
  • PinNames.h (Currently not accurate for the 11CXX, see below)
  • reserved_pins.h (Should be the same once PinNames is resolved)

Don't really understand the changes in pwmout_api.c? what's the reason that P1_6, P1_7, P1_1, P1_2, P1_3 are removed in LPC11XX? It looks like the differences between to the code are bugfixes that were not ported to the LPC11CXX. The relevant changes are in d0d2df3 (by Toyomasa Watarai), maybe he can comment.

PinNames needs to be updated according to the following differences:

PIN    111X              11C2X
17    PIO1_9/CT16B1_MAT0 --
18    PIO3_4             --
19    PIO2_4             --
20    PIO2_5             --
21    PIO3_5             --
22:   PIO0_6/SCK0        --
23:   PIO0_7/CTS         PIO0_6/SCK0  (Serial clock for SPI0)
24:   PIO2_9             PIO0_7/CTS (Clear To Send input for UART)

The SWDIO/SWCLK definition can be the same for both targets: Would it be an idea to leave them in the peripheral api's but disable them from being used in pinmap.c? Or would you rather pretend that they don't exist at all?

It could be something like:

void pin_function(PinName pin, int function) {
    if (pin == (uint32_t)NC) return;

#if DEVICE_DISABLE_SWD_PINS
    if(pin == P0_10 || pin == 1_3) {
        error("Remapping SWD pins disabled");
    }
#endif
    [...]
}

Use #if DEVICE_CAN for can_s definition
Merge back into spi_api.c. P0_10/SPI_0 (SWCLK) now disabled for both targets
Merge back into analog_api.c. P1_3/ADC0_4 (SWDIO) now disabled for both targets
@toyowata
Copy link
Contributor

what's the reason that P1_6, P1_7, P1_1, P1_2, P1_3 are removed in LPC11XX?

Because CT32B1 (P1_1, P1_2 and P1_3) is used by us_ticker.c for wait and ticker function. Since wait/ticker is commonly used by mbed code and I decided CT32B1 of LPC11XX should only be used for this function, not for PwmOut.

P1_6 and P1_7 are used by UART (USBTX/USBRX) and I think they should not be assigned to other function.

The SWDIO/SWCLK definition can be the same for both targets: Would it be an idea to leave them in the peripheral api's but disable them from being used in pinmap.c? Or would you rather pretend that they don't exist at all?

I prefer an idea by mbednotifications here:

#74 (comment)

The pinname.h should have SWDIO/SWCLK PinName (e.g. P0_10), but peripheral apis use them if DEVICE_SWD_PINS_AVAILABLE is defined (=1 in device.h).

Any comment on this?

@omdathetkan
Copy link
Contributor Author

Will create a new pull request including pwm_api.c (as well as fixing a typo in the last commit message)

@mbednotifications
Copy link

In general I would not like to see pinnames removed or disabled just because
they are used for special functions on mbed hardware. Note that new
platforms are appearing all the time and some may use different conventions.
Some people are also developing their own hardware and use mbed modules for
prototyping. It would be confusing and inconsistent to be forced to use a
different approach for missing pinsnames. In case some additional protection
is desired it may be an option to use a special define flag that either
enables or hides the pins in question.


From: mbed-devel@googlegroups.com [mailto:mbed-devel@googlegroups.com] On
Behalf Of Toyomasa Watarai
Sent: zondag 29 september 2013 5:05
To: mbedmicro/mbed
Subject: Re: [mbed] Merge common files between LPC11XX and LPC11CXX (#79)

what's the reason that P1_6, P1_7, P1_1, P1_2, P1_3 are removed in LPC11XX?

Because CT32B1 (P1_1, P1_2 and P1_3) is used by us_ticker.c for wait and
ticker function. Since wait/ticker is commonly used by mbed code and I
decided CT32B1 of LPC11XX should only be used for this function, not for
PwmOut.

P1_6 and P1_7 are used by UART (USBTX/USBRX) and I think they should not be
assigned to other function.

The SWDIO/SWCLK definition can be the same for both targets: Would it be an
idea to leave them in the peripheral api's but disable them from being used
in pinmap.c? Or would you rather pretend that they don't exist at all?

I prefer an idea by mbednotifications here:

#74 (comment)
#74 (comment)

The pinname.h should have SWDIO/SWCLK PinName (e.g. P0_10), but peripheral
apis use them if DEVICE_SWD_PINS_AVAILABLE is defined (=1 in device.h).

Any comment on this?

Reply to this email directly or view it
#79 (comment) on
GitHub.
<https://github.com/notifications/beacon/Je4ybK6to-jqRROsOi1IeP_kTnoxq2yv6Vz
ZTkxTN9oWfY3CJEpnXpR8PPTXaIZe.gif>

You received this message because you are subscribed to the Google Groups
"mbed-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to mbed-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

@omdathetkan
Copy link
Contributor Author

Note that the LPC11C24 has a few pins missing since they are taken up by the can tranceiver that's built into the chip.

I could see that disabling the SWD pins could make sense to prevent bricking, but it would be nice if that could be changed with a simple option in device.h, maybe the same for the serial pins.

@jasstrong
Copy link

A warning at compile time would be nice.

bridadan pushed a commit that referenced this pull request Jun 21, 2016
Add lifetime management to rtos::Thread
artokin pushed a commit to artokin/mbed-os that referenced this pull request Nov 16, 2017
… from d65b6b0..b1c9efb

b1c9efb Fix coap_connection_handler_send_data() return values (ARMmbed#81)
f9cb04f Delete transaction when not needed (ARMmbed#80)
daf3694 Message transaction memory handling changes (ARMmbed#79)
adc04c4 Add API to send response to request based on Message ID (ARMmbed#78)
58f0ed5 Limit number of ongoing handshakes  (ARMmbed#77)
42c1169 Fix redefinition of mbed TLS error codes (ARMmbed#76)
ba7a7c4 Added server mode certificate conf (ARMmbed#74)
d108199 Certificate set API changed. (ARMmbed#73)
2d622e0 Support for certificate mode (ARMmbed#72)

git-subtree-dir: features/nanostack/FEATURE_NANOSTACK/coap-service
git-subtree-split: b1c9efb
yossi2le pushed a commit to yossi2le/mbed-os that referenced this pull request Jan 2, 2019
* Update Jenkinsfile

* Slow down sending of mbedgt commands

So that the device serial buffer doesn't
overflow
artokin pushed a commit to artokin/mbed-os that referenced this pull request Feb 25, 2019
…c358..dd98c37

dd98c37 Merge pull request ARMmbed#85 from ARMmbed/sync_with_MbedOS
8418f4c (via Mbed OS) Add missing mbed_lib.json for frameworks and nanostack
eb0692e Merge pull request ARMmbed#84 from ARMmbed/nslist_iar7
7ce58bf Support C++03 compilers that cannot return properly-typed pointers.
2775dce Merge pull request ARMmbed#83 from ARMmbed/IOTTHD-3187
fef3c6d Remove references to yotta
a953636 Avoid memcmp(x, NULL, 0)
1de4b47 (split) Fix C++11 build with Arm Compiler 6 (ARMmbed#79)

git-subtree-dir: features/frameworks/nanostack-libservice
git-subtree-split: dd98c37c363acd0b6547ca59adc735ee52b2a7b1
linlingao added a commit to linlingao/mbed-os that referenced this pull request Jul 12, 2019
Fix return values on some error conditions
pan- added a commit to pan-/mbed that referenced this pull request May 29, 2020
Updating mbed-os to mbed-os-5.4.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants