{"action":"created","issue":{"url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/566","repository_url":"https://api.github.com/repos/MKFirmware/MK4duo","labels_url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/566/labels{/name}","comments_url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/566/comments","events_url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/566/events","html_url":"https://github.com/MKFirmware/MK4duo/issues/566","id":352053381,"node_id":"MDU6SXNzdWUzNTIwNTMzODE=","number":566,"title":"SPI RATE","user":{"login":"Micilera","id":22821538,"node_id":"MDQ6VXNlcjIyODIxNTM4","avatar_url":"https://avatars2.githubusercontent.com/u/22821538?v=4","gravatar_id":"","url":"https://api.github.com/users/Micilera","html_url":"https://github.com/Micilera","followers_url":"https://api.github.com/users/Micilera/followers","following_url":"https://api.github.com/users/Micilera/following{/other_user}","gists_url":"https://api.github.com/users/Micilera/gists{/gist_id}","starred_url":"https://api.github.com/users/Micilera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Micilera/subscriptions","organizations_url":"https://api.github.com/users/Micilera/orgs","repos_url":"https://api.github.com/users/Micilera/repos","events_url":"https://api.github.com/users/Micilera/events{/privacy}","received_events_url":"https://api.github.com/users/Micilera/received_events","type":"User","site_admin":false},"labels":[{"id":439106950,"node_id":"MDU6TGFiZWw0MzkxMDY5NTA=","url":"https://api.github.com/repos/MKFirmware/MK4duo/labels/Suggestion","name":"Suggestion","color":"84b6eb","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-20T09:28:07Z","updated_at":"2018-09-01T08:29:14Z","closed_at":"2018-09-01T08:29:14Z","author_association":"NONE","body":"Firmware version v4.3.6\r\nHW SPI on an arduino DUE using an SDCard\r\n\r\nIn ..\\src\\HAL\\HAL_DUE\\HAL_spi_Due.cpp, there are two member functions: HAL::spiBegin() and HAL::spiInit().\r\nInside spiBegin there is a call to spiInit(1).\r\n\r\nISSUE 1 -- Why is used a default rate of 4 Mhz (see spiDueDividors[]) in such a fix way?\r\n\r\nIf the spiBegin is called once, the flag spiInitMaded is set to true. So, after this call all the following calls to spiInit() do nothing. \r\nIn this way in Sd2Card::init(), line 3142 spiInit() does nothing because spiBegin is called few line above.\r\nMore than that, if the init function return OK, so that the final rate would be set, the call of  spiInit() in every chipselect() calls does nothing. \r\n\r\nISSUE 2 -- At the end, the SDCard runs at the rate hard coded  in spiBegin().\r\n\r\nIn ..src\\HAL\\HAL_spi_Due.cpp, line 166:\r\n\r\n      if (spiRate > 6) spiRate = 1;\r\n\r\nISSUE 3 -- Why is made that choice? It would be more reasonable to select as the default rate the slowest, not one of the faster.\r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/comments/417842771","html_url":"https://github.com/MKFirmware/MK4duo/issues/566#issuecomment-417842771","issue_url":"https://api.github.com/repos/MKFirmware/MK4duo/issues/566","id":417842771,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzg0Mjc3MQ==","user":{"login":"iosonopersia","id":19174859,"node_id":"MDQ6VXNlcjE5MTc0ODU5","avatar_url":"https://avatars2.githubusercontent.com/u/19174859?v=4","gravatar_id":"","url":"https://api.github.com/users/iosonopersia","html_url":"https://github.com/iosonopersia","followers_url":"https://api.github.com/users/iosonopersia/followers","following_url":"https://api.github.com/users/iosonopersia/following{/other_user}","gists_url":"https://api.github.com/users/iosonopersia/gists{/gist_id}","starred_url":"https://api.github.com/users/iosonopersia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iosonopersia/subscriptions","organizations_url":"https://api.github.com/users/iosonopersia/orgs","repos_url":"https://api.github.com/users/iosonopersia/repos","events_url":"https://api.github.com/users/iosonopersia/events{/privacy}","received_events_url":"https://api.github.com/users/iosonopersia/received_events","type":"User","site_admin":false},"created_at":"2018-09-01T08:29:14Z","updated_at":"2018-09-01T08:29:14Z","author_association":"COLLABORATOR","body":"@Micilera `ISSUE 1` and `ISSUE 2` are now fixed. What it's left is `ISSUE 3`.\r\n\r\nThe default behaviour is max speed for SDCard connection, since slower speeds should be explicitly selected by the user enabling `SDSLOW` or `SDEXTRASLOW` in the configuration. One of the advantages of the SDCard over the USB+host option is its speed and reliability, so that's what users should expect by default.\r\n\r\nAnyway, actually `spiRate = 1` corresponds to the `SDSLOW` option, while the fastest speed would be achieved through `spiRate = 0` . `SDSLOW` is half the full speed, so that's should be a safe value.\r\n\r\nI'm going to close this issue but I recognise there's still some work to do for SPI.\r\nThank's a lot @Micilera for helping us!"}}
{"actor":{"display_login":"iosonopersia"}}