{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3863","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3863/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3863/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3863/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/3863","id":211206470,"number":3863,"title":"STM32F767ZI CAN object instantiation fail if bus is active.","user":{"login":"bperry730","id":9127559,"avatar_url":"https://avatars1.githubusercontent.com/u/9127559?v=3","gravatar_id":"","url":"https://api.github.com/users/bperry730","html_url":"https://github.com/bperry730","followers_url":"https://api.github.com/users/bperry730/followers","following_url":"https://api.github.com/users/bperry730/following{/other_user}","gists_url":"https://api.github.com/users/bperry730/gists{/gist_id}","starred_url":"https://api.github.com/users/bperry730/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bperry730/subscriptions","organizations_url":"https://api.github.com/users/bperry730/orgs","repos_url":"https://api.github.com/users/bperry730/repos","events_url":"https://api.github.com/users/bperry730/events{/privacy}","received_events_url":"https://api.github.com/users/bperry730/received_events","type":"User","site_admin":false},"labels":[{"id":328051906,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/devices:%20st","name":"devices: st","color":"0052cc","default":false},{"id":28847979,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/type:%20bug","name":"type: bug","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-03-01T20:59:49Z","updated_at":"2017-06-27T19:33:11Z","closed_at":"2017-05-26T15:45:29Z","body":"### Description\r\n- Type: Bug\r\n- Priority: Blocker\r\n\r\n---------------------------------------------------------------\r\n## Bug\r\n\r\n**Target**\r\nnucleo_f767zi\r\n\r\n**Toolchain:**\r\nGCC_ARM\r\n\r\n**mbed-cli version:** \r\n1.0.0\r\n\r\n**meed-os sha:**\r\nbcf7085\r\n\r\n**Expected behavior**\r\nSTM32F767ZI CAN objects can be instantiated regardless of CAN bus usage.\r\n\r\n**Actual behavior**\r\nCAN objects will be instantiated if the CAN bus is not currently in use.  However, if there is another node on the CAN bus that is broadcasting at the time of instantiation, then the CAN bus instantiation hangs until the bus is no longer in use.\r\n\r\n**Steps to reproduce**\r\nTo reproduce, have a node broadcast on a CAN bus shared with the STM32F767ZI (I did this at roughly 100ms intervals for my application).  Try instantiating a CAN object using the pins connected to the bus.  The instantiation should hang until the other node stops broadcasting or is disconnected from the bus, and then the code should continue executing per usual.  If there is no CAN bus traffic, then there shouldn't be an issue (this was tested with the LPC1768 and produced the expected behaviour).\r\n\r\nBelow is a simpler version of the code I used to test this:\r\n```C++\r\n#include \"mbed.h\"\r\n\r\nTicker ticker;\r\nDigitalOut led1(LED1);\r\nDigitalOut led2(LED2);\r\nCAN* can2_ptr;//(PD_0, PD_1);\r\n\r\nSerial pc(USBTX,USBRX);\r\n\r\nint main()\r\n{\r\n    pc.baud(115200);\r\n    pc.printf(\"main()\\r\\n\");\r\n    //CAN can2(p9, p10); //for LPC1768\r\n    CAN can2(PD_0, PD_1); //for STM32F767ZI\r\n    pc.printf(\"created can\\r\\n\");\r\n    can2_ptr = &can2;\r\n    can2.frequency(500000);\r\n    pc.printf(\"set frequency \\r\\n\");\r\n    CANMessage msg;\r\n\r\n    while(1) {\r\n        if(can2.read(msg)) {\r\n            pc.printf(\"<-*******Message received:id=%x,data=\",msg.id);\r\n            for(int i=0; i<8; i++) {\r\n                pc.printf(\"%x,\",msg.data[i] );\r\n            }\r\n            pc.printf(\"\\n\\r\");\r\n            led2 = !led2;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThis code should not print the \"created CAN\" line.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/311461510","html_url":"https://github.com/ARMmbed/mbed-os/issues/3863#issuecomment-311461510","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/3863","id":311461510,"user":{"login":"bperry730","id":9127559,"avatar_url":"https://avatars1.githubusercontent.com/u/9127559?v=3","gravatar_id":"","url":"https://api.github.com/users/bperry730","html_url":"https://github.com/bperry730","followers_url":"https://api.github.com/users/bperry730/followers","following_url":"https://api.github.com/users/bperry730/following{/other_user}","gists_url":"https://api.github.com/users/bperry730/gists{/gist_id}","starred_url":"https://api.github.com/users/bperry730/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bperry730/subscriptions","organizations_url":"https://api.github.com/users/bperry730/orgs","repos_url":"https://api.github.com/users/bperry730/repos","events_url":"https://api.github.com/users/bperry730/events{/privacy}","received_events_url":"https://api.github.com/users/bperry730/received_events","type":"User","site_admin":false},"created_at":"2017-06-27T19:33:11Z","updated_at":"2017-06-27T19:33:11Z","body":"This problem has been reintroduced in the latest mbed-os version.  The can frequency is hard-coded again.  Should I open a new issue?"}}
{"actor":{"display_login":"bperry730"}}