-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[LPC1347] PWMout freq on 16 bit timers wrong #2660
Comments
The problem is: clock of 72 MHz / 2^16 gives a max pwm period time of about 0.9 ms. |
cc @toyowata |
I got the LPCXpresso1347 board and just started to see detail. I hope same fix as the LPC11XX can be used. I will investigate more. |
Great, And thanks for your help. I have attached the modified source, I don’t know if my pull request did work. Another thing to note: there is a definition for CT32B1, but this is used for the internal mbed ticker and also for USB, so these PWM pins should not be used. Then I use the LPC1347 with the LPCXpresso. I have created the startup code for this toolchain and modified the linker script to use the nano lib, otherwise the generated code will not fit into this controller. Regards, Johannes Von: Toyomasa Watarai [mailto:[email protected]] I got the LPCXpresso1347 board and just started to see detail. I hope same fix as the LPC11XX can be used. I will investigate more. — /* mbed Microcontroller Library
#define TCR_CNT_EN 0x00000001 /* To have a PWM where we can change both the period and the duty cycle,
typedef struct { static timer_mr pwm_timer_map[11] = { static LPC_CTxxBx_Type *Timers[4] = { static unsigned int pwm_clock_mhz; void pwmout_init(pwmout_t* obj, PinName pin) {
} void pwmout_free(pwmout_t* obj) { void pwmout_write(pwmout_t* obj, float value) {
} float pwmout_read(pwmout_t* obj) {
} void pwmout_period(pwmout_t* obj, float seconds) { void pwmout_period_ms(pwmout_t* obj, int ms) { // Set the PWM period, keeping the duty cycle the same.
} void pwmout_pulsewidth(pwmout_t* obj, float seconds) { void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) { void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
} |
…..225a4af 225a4af Remove files from tests folder 58d2c8f Merge remote-tracking branch 'origin/release_internal' into release_external 921b4b3 Wi-SUN FAN 1.1 dynamic MDR data request enabler b8722e8 Corrected BR removing of waiting list entry when supplicant is in key storage 0d54d7a Adjust trace levels (ARMmbed#2692) 681d9ea Added reset for pan id and version to BR network start 30d4fb2 Renaming and cleaning ws bootstrap (ARMmbed#2688) e0da19d Add Wi-SUN host configuration (ARMmbed#2690) 50ecc3d Refactoring Wi-SUN stack (ARMmbed#2686) 9d2386d Renamed operation mode to operating mode. 2f755bc RF config resolver and some refactoring (ARMmbed#2683) 86c6d19 Fixed WS IE PCAP read operation wrong length usage. cd3a4c2 Config: Remove additional HAVE_WS_ROUTER (ARMmbed#2684) cdd7f2d Added API for configure supported Phy capability. a00a3c0 Wi-SUN FAN 1.1 PCAP IE update 2d063d3 Moved State machine and timer functions to own files edb8bec Corrected system time check function return values 85358a6 Moved Wi-SUN Bootstrap Event handling to separate device handlers 61cbdde MAC to support mode switch on single channel (ARMmbed#2678) 1006d29 Added storing of PAN ID to NVM in BBR 7bf0028 Corrected system time jump detection on BR startup e60974d Split Wi-SUN bootstrap to device types a3f3412 MAC data req: API to support mode switch (ARMmbed#2674) cad5122 Removed automatic network size configuration (ARMmbed#2673) 35d3132 MAC: Callback set to resolve PHY mode ID (ARMmbed#2672) 0c5faca Added support for large system time changes (e.g. due to NTP) (ARMmbed#2670) c94b306 LFN version and LGTK Hash IE advertisment and learn 8e07511 Use FAN version constant instead of pure number a5566b2 Channel Plan 2 validation and FAN 1.0 reject 42dba41 Wi-Sun IE FAN 1.1 update 1d56070 EU channel plan ids (FAN 1.1) supported (ARMmbed#2668) fc4f41f Add test API empty function 37efc7e Add version 1.1 basic support e1558fb Implemented mode switch PHR build and parse (ARMmbed#2665) cbd8a15 Corrected frame counter storing threshold check 37f7ae9 Time configuration distribution using DHCPv6 vendor data 7415bc7 Added checks for Border Router frame counter space exhaustion (ARMmbed#2660) f1a65ec Mode switch PHY API (ARMmbed#2663) e54231b Do not check buffer age when virtual RF driver used (ARMmbed#2662) cc8c7bd arm_network_certificate_chain_set() returns -2 when PANA is disabled 319dd91 Fix dubious semicolon in #define 2ff51ab Remove extra '\n' in traces 19376c8 Simplify array indexes c808661 Fix ASAN warnings about overflows in bit shifts f998008 Fix use-after-free in mac_helper_coordinator_address_set() 4d04541 Wi-SUN header and Paylod IE element lenght future proof update. 935898b Medium network PAN_TIMEOUT changed to 30 minutes 1af7cfe Updated nanostack to be compatible with mbed TLS 3.0 (ARMmbed#2657) 29744e0 If Router Solicitation creation fails no longer tries to retry the RS right away (ARMmbed#2655) 2b889e9 Added automatic test procedure triggering during bootstrap ed9eb05 GTKs are removed only when fresh GTK hash is received 81ecdc2 Added empty function for test procedure trigger 14439b4 Added support for triggering test procedures b8a67a9 Update CHANGELOG.md for Nanostack 14.0.0 (ARMmbed#2649) git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 225a4af
…..225a4af 225a4af Remove files from tests folder 58d2c8f Merge remote-tracking branch 'origin/release_internal' into release_external 921b4b3 Wi-SUN FAN 1.1 dynamic MDR data request enabler b8722e8 Corrected BR removing of waiting list entry when supplicant is in key storage 0d54d7a Adjust trace levels (ARMmbed#2692) 681d9ea Added reset for pan id and version to BR network start 30d4fb2 Renaming and cleaning ws bootstrap (ARMmbed#2688) e0da19d Add Wi-SUN host configuration (ARMmbed#2690) 50ecc3d Refactoring Wi-SUN stack (ARMmbed#2686) 9d2386d Renamed operation mode to operating mode. 2f755bc RF config resolver and some refactoring (ARMmbed#2683) 86c6d19 Fixed WS IE PCAP read operation wrong length usage. cd3a4c2 Config: Remove additional HAVE_WS_ROUTER (ARMmbed#2684) cdd7f2d Added API for configure supported Phy capability. a00a3c0 Wi-SUN FAN 1.1 PCAP IE update 2d063d3 Moved State machine and timer functions to own files edb8bec Corrected system time check function return values 85358a6 Moved Wi-SUN Bootstrap Event handling to separate device handlers 61cbdde MAC to support mode switch on single channel (ARMmbed#2678) 1006d29 Added storing of PAN ID to NVM in BBR 7bf0028 Corrected system time jump detection on BR startup e60974d Split Wi-SUN bootstrap to device types a3f3412 MAC data req: API to support mode switch (ARMmbed#2674) cad5122 Removed automatic network size configuration (ARMmbed#2673) 35d3132 MAC: Callback set to resolve PHY mode ID (ARMmbed#2672) 0c5faca Added support for large system time changes (e.g. due to NTP) (ARMmbed#2670) c94b306 LFN version and LGTK Hash IE advertisment and learn 8e07511 Use FAN version constant instead of pure number a5566b2 Channel Plan 2 validation and FAN 1.0 reject 42dba41 Wi-Sun IE FAN 1.1 update 1d56070 EU channel plan ids (FAN 1.1) supported (ARMmbed#2668) fc4f41f Add test API empty function 37efc7e Add version 1.1 basic support e1558fb Implemented mode switch PHR build and parse (ARMmbed#2665) cbd8a15 Corrected frame counter storing threshold check 37f7ae9 Time configuration distribution using DHCPv6 vendor data 7415bc7 Added checks for Border Router frame counter space exhaustion (ARMmbed#2660) f1a65ec Mode switch PHY API (ARMmbed#2663) e54231b Do not check buffer age when virtual RF driver used (ARMmbed#2662) cc8c7bd arm_network_certificate_chain_set() returns -2 when PANA is disabled 319dd91 Fix dubious semicolon in #define 2ff51ab Remove extra '\n' in traces 19376c8 Simplify array indexes c808661 Fix ASAN warnings about overflows in bit shifts f998008 Fix use-after-free in mac_helper_coordinator_address_set() 4d04541 Wi-SUN header and Paylod IE element lenght future proof update. 935898b Medium network PAN_TIMEOUT changed to 30 minutes 1af7cfe Updated nanostack to be compatible with mbed TLS 3.0 (ARMmbed#2657) 29744e0 If Router Solicitation creation fails no longer tries to retry the RS right away (ARMmbed#2655) 2b889e9 Added automatic test procedure triggering during bootstrap ed9eb05 GTKs are removed only when fresh GTK hash is received 81ecdc2 Added empty function for test procedure trigger 14439b4 Added support for triggering test procedures b8a67a9 Update CHANGELOG.md for Nanostack 14.0.0 (ARMmbed#2649) git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 225a4af
…a3c5c5..225a4af 225a4af Remove files from tests folder 58d2c8f Merge remote-tracking branch 'origin/release_internal' into release_external 921b4b3 Wi-SUN FAN 1.1 dynamic MDR data request enabler b8722e8 Corrected BR removing of waiting list entry when supplicant is in key storage 0d54d7a Adjust trace levels (ARMmbed#2692) 681d9ea Added reset for pan id and version to BR network start 30d4fb2 Renaming and cleaning ws bootstrap (ARMmbed#2688) e0da19d Add Wi-SUN host configuration (ARMmbed#2690) 50ecc3d Refactoring Wi-SUN stack (ARMmbed#2686) 9d2386d Renamed operation mode to operating mode. 2f755bc RF config resolver and some refactoring (ARMmbed#2683) 86c6d19 Fixed WS IE PCAP read operation wrong length usage. cd3a4c2 Config: Remove additional HAVE_WS_ROUTER (ARMmbed#2684) cdd7f2d Added API for configure supported Phy capability. a00a3c0 Wi-SUN FAN 1.1 PCAP IE update 2d063d3 Moved State machine and timer functions to own files edb8bec Corrected system time check function return values 85358a6 Moved Wi-SUN Bootstrap Event handling to separate device handlers 61cbdde MAC to support mode switch on single channel (ARMmbed#2678) 1006d29 Added storing of PAN ID to NVM in BBR 7bf0028 Corrected system time jump detection on BR startup e60974d Split Wi-SUN bootstrap to device types a3f3412 MAC data req: API to support mode switch (ARMmbed#2674) cad5122 Removed automatic network size configuration (ARMmbed#2673) 35d3132 MAC: Callback set to resolve PHY mode ID (ARMmbed#2672) 0c5faca Added support for large system time changes (e.g. due to NTP) (ARMmbed#2670) c94b306 LFN version and LGTK Hash IE advertisment and learn 8e07511 Use FAN version constant instead of pure number a5566b2 Channel Plan 2 validation and FAN 1.0 reject 42dba41 Wi-Sun IE FAN 1.1 update 1d56070 EU channel plan ids (FAN 1.1) supported (ARMmbed#2668) fc4f41f Add test API empty function 37efc7e Add version 1.1 basic support e1558fb Implemented mode switch PHR build and parse (ARMmbed#2665) cbd8a15 Corrected frame counter storing threshold check 37f7ae9 Time configuration distribution using DHCPv6 vendor data 7415bc7 Added checks for Border Router frame counter space exhaustion (ARMmbed#2660) f1a65ec Mode switch PHY API (ARMmbed#2663) e54231b Do not check buffer age when virtual RF driver used (ARMmbed#2662) cc8c7bd arm_network_certificate_chain_set() returns -2 when PANA is disabled 319dd91 Fix dubious semicolon in #define 2ff51ab Remove extra '\n' in traces 19376c8 Simplify array indexes c808661 Fix ASAN warnings about overflows in bit shifts f998008 Fix use-after-free in mac_helper_coordinator_address_set() 4d04541 Wi-SUN header and Paylod IE element lenght future proof update. 935898b Medium network PAN_TIMEOUT changed to 30 minutes 1af7cfe Updated nanostack to be compatible with mbed TLS 3.0 (ARMmbed#2657) 29744e0 If Router Solicitation creation fails no longer tries to retry the RS right away (ARMmbed#2655) 2b889e9 Added automatic test procedure triggering during bootstrap ed9eb05 GTKs are removed only when fresh GTK hash is received 81ecdc2 Added empty function for test procedure trigger 14439b4 Added support for triggering test procedures b8a67a9 Update CHANGELOG.md for Nanostack 14.0.0 (ARMmbed#2649) git-subtree-dir: connectivity/nanostack/sal-stack-nanostack git-subtree-split: 225a4af
Description
Bug
PWMout frequency is higher than set in pwm.period(). This happens on pwm pins with 16 bit counters CT16B0 / CT16B1, on CT32B0 it works as expected.
Target
LPC1347
Toolchain:
ARM, online compiler
mbed lib 64...125
Expected behavior
pwm.period(0.01) -> 10 ms
Actual behavior
pwm.period(0.01) -> 0.898 ms
Steps to reproduce
The text was updated successfully, but these errors were encountered: