{"action":"created","issue":{"url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/301","repository_url":"https://api.github.com/repos/chipKIT32/chipKIT-core","labels_url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/301/comments","events_url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/301/events","html_url":"https://github.com/chipKIT32/chipKIT-core/issues/301","id":190227388,"number":301,"title":"pwm frequency won't change?","user":{"login":"tanthua","id":10667392,"avatar_url":"https://avatars.githubusercontent.com/u/10667392?v=3","gravatar_id":"","url":"https://api.github.com/users/tanthua","html_url":"https://github.com/tanthua","followers_url":"https://api.github.com/users/tanthua/followers","following_url":"https://api.github.com/users/tanthua/following{/other_user}","gists_url":"https://api.github.com/users/tanthua/gists{/gist_id}","starred_url":"https://api.github.com/users/tanthua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanthua/subscriptions","organizations_url":"https://api.github.com/users/tanthua/orgs","repos_url":"https://api.github.com/users/tanthua/repos","events_url":"https://api.github.com/users/tanthua/events{/privacy}","received_events_url":"https://api.github.com/users/tanthua/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-11-18T03:25:18Z","updated_at":"2016-11-19T16:08:36Z","closed_at":null,"body":"Hi. I'm using chipkit uc32. \r\nI picked this code up from another issue that was resolved here, and it was compiled and uploaded successfully. However, when I measured the frequency of pin 3 or pin 5, they remained the same around 498 Hz. I would like to change the frequency up to 12 kHz but never got it working. I tried both timer2 and timer3.\r\n\r\nAlso, I used the Arduino IDE with chipkit library. When I uploaded the sketch from \"StandardFirmataForChipkit\", the frequency of pwm dropped from 498Hz to 398Hz constantly. \r\n\r\nCan you give me explanations for those incidents and also provide me a complete example how to change the frequency of pin 3 or 5 of the chipkit on Arduino IDE?\r\n```\r\nvoid setup() {\r\n  T2CONbits.ON = 0;         // Turn the timer off\r\n  T2CONbits.TCKPS = 0b011;        // Set prescaler\r\n  TMR2 = 0;                 // Clear the counter\r\n  PR2 = 4096;               // Set the period\r\n  T2CONbits.ON = 1;         // Turn the timer on\r\n\r\n  T3CONbits.ON = 0;         // Turn the timer off\r\n  T3CONbits.TCKPS = 0b011;        // Set prescaler\r\n  TMR3 = 0;                 // Clear the counter\r\n  PR3 = 4096;               // Set the period\r\n  T3CONbits.ON = 1;         // Turn the timer on\r\n}\r\n\r\nvoid loop() {\r\n  analogWrite(3, 127);\r\n  analogWrite(5, 127);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/comments/261722500","html_url":"https://github.com/chipKIT32/chipKIT-core/issues/301#issuecomment-261722500","issue_url":"https://api.github.com/repos/chipKIT32/chipKIT-core/issues/301","id":261722500,"user":{"login":"tanthua","id":10667392,"avatar_url":"https://avatars.githubusercontent.com/u/10667392?v=3","gravatar_id":"","url":"https://api.github.com/users/tanthua","html_url":"https://github.com/tanthua","followers_url":"https://api.github.com/users/tanthua/followers","following_url":"https://api.github.com/users/tanthua/following{/other_user}","gists_url":"https://api.github.com/users/tanthua/gists{/gist_id}","starred_url":"https://api.github.com/users/tanthua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanthua/subscriptions","organizations_url":"https://api.github.com/users/tanthua/orgs","repos_url":"https://api.github.com/users/tanthua/repos","events_url":"https://api.github.com/users/tanthua/events{/privacy}","received_events_url":"https://api.github.com/users/tanthua/received_events","type":"User","site_admin":false},"created_at":"2016-11-19T16:08:36Z","updated_at":"2016-11-19T16:08:36Z","body":"Can you elaborate it a bit more? I'm not sure I get that. "}}
{"actor":{"display_login":"tanthua"}}