{"action":"created","issue":{"url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/498","repository_url":"https://api.github.com/repos/Lora-net/LoRaMac-node","labels_url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/498/labels{/name}","comments_url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/498/comments","events_url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/498/events","html_url":"https://github.com/Lora-net/LoRaMac-node/pull/498","id":336547800,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3OTcyNjcy","number":498,"title":"SX126X: Fixed Rx2 Issue in Class C and the function \"printf()\" can't work issue","user":{"login":"BillowMai","id":26321991,"node_id":"MDQ6VXNlcjI2MzIxOTkx","avatar_url":"https://avatars0.githubusercontent.com/u/26321991?v=4","gravatar_id":"","url":"https://api.github.com/users/BillowMai","html_url":"https://github.com/BillowMai","followers_url":"https://api.github.com/users/BillowMai/followers","following_url":"https://api.github.com/users/BillowMai/following{/other_user}","gists_url":"https://api.github.com/users/BillowMai/gists{/gist_id}","starred_url":"https://api.github.com/users/BillowMai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BillowMai/subscriptions","organizations_url":"https://api.github.com/users/BillowMai/orgs","repos_url":"https://api.github.com/users/BillowMai/repos","events_url":"https://api.github.com/users/BillowMai/events{/privacy}","received_events_url":"https://api.github.com/users/BillowMai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-28T09:40:56Z","updated_at":"2018-07-12T11:54:21Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/Lora-net/LoRaMac-node/pulls/498","html_url":"https://github.com/Lora-net/LoRaMac-node/pull/498","diff_url":"https://github.com/Lora-net/LoRaMac-node/pull/498.diff","patch_url":"https://github.com/Lora-net/LoRaMac-node/pull/498.patch"},"body":"Below are my experience and solutions on developing LoRaWAN Class C on SX1262.\r\n\r\nHardware: NUCLEO-L152RE + SX1262DVK1DAS.\r\ncmake settings:\r\ncmake -DCMAKE_TOOLCHAIN_FILE=\"cmake/toolchain-arm-none-eabi.cmake\" ^\r\n      -DCMAKE_SH=\"CMAKE_SH-NOTFOUND\" ^\r\n      -DTOOLCHAIN_PREFIX=\"C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major\" ^\r\n      -DAPPLICATION=\"LoRaMac\" ^\r\n      -DCLASS=\"classC\" ^\r\n      -DACTIVE_REGION=\"LORAMAC_REGION_AS923\" ^\r\n      -DMODULATION=\"LORA\" ^\r\n      -DBOARD=\"NucleoL152\" ^\r\n      -DMBED_RADIO_SHIELD=\"SX1262DVK1DAS\" ^\r\n      -DREGION_EU868=\"OFF\" ^\r\n      -DREGION_US915=\"OFF\" ^\r\n      -DREGION_CN779=\"OFF\" ^\r\n      -DREGION_EU433=\"OFF\" ^\r\n      -DREGION_AU915=\"OFF\" ^\r\n      -DREGION_AS923=\"ON\" ^\r\n      -DREGION_CN470=\"OFF\" ^\r\n      -DREGION_KR920=\"OFF\" ^\r\n      -DREGION_IN865=\"OFF\" ^\r\n      -DREGION_US915_HYBRID=\"OFF\" ^\r\n      -G \"MSYS Makefiles\" ..\r\n\r\nafter testing, we could find that 1) the \"printf()\" function could not work(for me the \"dbg tool\" is hard to use, so I first should make the UART and \"printf()\" working to debug the project) . 2)track the Rx2 process, and found that the RF chip didn't enter rx mode while the MAC layer requires opening Rx2.\r\n\r\nbelow are the solutions:\r\n1) fix printf() issue. The implementation of \"printf\" is different between GCC and KEIL compiler. In the GCC, the \"printf\" function should be redefined by \"int _write(int fd, char *pBuffer, int size)\" .\r\n\r\nFile location \"src/boards/NucleoL152/board.c\"\r\n+int _write(int fd, char *pBuffer, int size)// for gcc \r\n+{\r\n+    //HAL_UART_Transmit(&Uart2, pBuffer, size, 0xff);\r\n+    for (int i = 0; i < size; i++){\r\n+        while( UartPutChar( &Uart2, pBuffer[i] ) != 0 );\r\n+    }\r\n+    return size;\r\n+}\r\n\r\n2) RX2 Issue. \r\nFirst, the SX126x driver code didn't provide a right chip state, because the variable OperatingMode in sx126x.c didn't update the state after TxDone/RxDone/...interruption, actually, the chip has automatically turned back to standby mode after TxDone/RxDone/......(changed file \"\"void RadioIrqProcess( void )\")\r\n\r\nFile location \"src/radio/sx126x/radio.c\"\r\nvoid RadioIrqProcess( void )\r\n//....\r\n         if( ( irqRegs & IRQ_TX_DONE ) == IRQ_TX_DONE )\r\n         {\r\n +            OperatingMode = MODE_STDBY_RC;\r\n             TimerStop( &TxTimeoutTimer );\r\n//....\r\n\r\nSecond, We should set the last Rx2 window to continuous mode in Class C, this is the difference from Clase A ,   so we should set the rx timeout value to 0.(change file)\r\n\r\nFile location \"src/mac/LoRaMac.c\"\r\n static void OpenContinuousRx2Window( void )\r\n {\r\n+    RxWindow2Config.WindowTimeout = 0;\r\n     OnRxWindow2TimerEvent( );\r\n     RxSlot = RX_SLOT_WIN_CLASS_C;\r\n }\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/comments/404486785","html_url":"https://github.com/Lora-net/LoRaMac-node/pull/498#issuecomment-404486785","issue_url":"https://api.github.com/repos/Lora-net/LoRaMac-node/issues/498","id":404486785,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDQ4Njc4NQ==","user":{"login":"mluis1","id":5763295,"node_id":"MDQ6VXNlcjU3NjMyOTU=","avatar_url":"https://avatars0.githubusercontent.com/u/5763295?v=4","gravatar_id":"","url":"https://api.github.com/users/mluis1","html_url":"https://github.com/mluis1","followers_url":"https://api.github.com/users/mluis1/followers","following_url":"https://api.github.com/users/mluis1/following{/other_user}","gists_url":"https://api.github.com/users/mluis1/gists{/gist_id}","starred_url":"https://api.github.com/users/mluis1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mluis1/subscriptions","organizations_url":"https://api.github.com/users/mluis1/orgs","repos_url":"https://api.github.com/users/mluis1/repos","events_url":"https://api.github.com/users/mluis1/events{/privacy}","received_events_url":"https://api.github.com/users/mluis1/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T11:54:21Z","updated_at":"2018-07-12T11:54:21Z","author_association":"CONTRIBUTOR","body":"Thanks for the propositions.\r\n\r\nUnfortunately we can accept this pull-request as is because you have proposed it against `master` branch.\r\nPull-requests must always be done against develop branch as described on the following document [Repository Rules (Issues Pull Requests reporting)](https://github.com/Lora-net/LoRaMac-node/wiki/Repository-Rules-(Issues-Pull-Requests-reporting))\r\n\r\nIt would also be nice if you could split the pull-requests by topic. By doing so it eases the review process.\r\n\r\nConcerning the proposed fixes\r\n* `printf issue`: The reported issue has already been corrected in the latest commits done on develop branch.\r\n* `Rx2 issue`: Could you please make a new pull request with the proposed solution to fix the issue?\r\n\r\nOnce you have proposed a new pull-request we will analyze it and come back to you as soon as possible.\r\n\r\nSorry for the inconvenience."}}
{"actor":{"display_login":"mluis1"}}