drivers/gsm: add a (generic) gsm driver, with support for UBlox and Quectel.#10086
drivers/gsm: add a (generic) gsm driver, with support for UBlox and Quectel.#10086maxvankessel wants to merge 5 commits intoRIOT-OS:masterfrom
Conversation
| bool invert_status_pin; /**< select inversion of status pin */ | ||
| gpio_t reset_pin; /**< quectel reset pin*/ | ||
| bool invert_reset_pin; /**< select inversion of reset pin*/ | ||
| gpio_t dtr_pin; /**< quectel dtr pin (modem intput) */ |
There was a problem hiding this comment.
this dtr_pin seems to be very common in modem equipment. I think it makes sense to make it part of the gsm params, similar to the ri_pin. Also, typo in comment: intput.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
|
@leandrolanzieri could you maybe have a look at this? |
Sure, will do |
There was a problem hiding this comment.
@maxvankessel thanks for this. It's a long PR so I still haven't gone through all the modules, here are some comments mostly on the basic gsm module. More to come ;-) I'm trying to test this on an UBlox module, yet with no success. It would be nice to have someone test this on a Quectel.
EDIT: Also, please rebase before addressing any changes.
| @@ -0,0 +1,97 @@ | |||
| /* | |||
There was a problem hiding this comment.
Why are the vendor specific headers being added in this commit?
| extern "C" { | ||
| #endif | ||
|
|
||
| typedef enum { |
There was a problem hiding this comment.
Please add documentation for these enums and structs.
| /** | ||
| * @brief gsm thread stack size | ||
| */ | ||
| #ifndef GSM_THREAD_STACKSIZE |
There was a problem hiding this comment.
I guess some of the macros could be added to the compile configuration group (config)?
| * @brief small line buffer size | ||
| */ | ||
| #ifndef GSM_AT_LINEBUFFER_SIZE_SMALL | ||
| #define GSM_AT_LINEBUFFER_SIZE_SMALL (32) |
There was a problem hiding this comment.
Maybe you could spare a comment on what's the use of these two sizes? So the user knows what this config is affecting.
| * | ||
| * @param[in] dev device to act on | ||
| * | ||
| * @return 0 for succes |
There was a problem hiding this comment.
| * @return 0 for succes | |
| * @return 0 for success |
| bool quotes = false; | ||
|
|
||
| pos += fmt_str(pos, "AT+CPIN="); | ||
| if (strlen(puk) == 8) { |
There was a problem hiding this comment.
I think this is not safe. Calling strlen with a NULL pointer has an undefined behaviour, and this is being directly called with NULL from gsm_set_pin.
| return res; | ||
| } | ||
|
|
||
| int __attribute__((weak)) gsm_signal_to_rssi(unsigned rssi) |
There was a problem hiding this comment.
What about moving the specific implementation to the driver?
|
|
||
| int res = at_send_cmd_get_resp(&dev->at_dev, "AT+CSQ", buf, sizeof(buf), | ||
| GSM_SERIAL_TIMEOUT_US); | ||
| if ((res > 2) && strncmp(buf, "+CSQ: ", 6) == 0) { |
There was a problem hiding this comment.
Where does the 2 come from?
| } | ||
|
|
||
|
|
||
| ssize_t gsm_cmd(gsm_t *dev, const char *cmd, uint8_t *buf, size_t len, unsigned timeout) |
There was a problem hiding this comment.
This function could be reused by others in the module.
|
|
||
| #endif | ||
|
|
||
| #ifdef GSM_HAS_THREAD |
There was a problem hiding this comment.
Maybe this macro logic could be simplified as right now there is no use for the thread unless AT_URC is being used.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
I've extended the PR #8602 "gsm" driver from @vincent-d.
Features of the PR (which incorporates functionality from other PR's):
Testing procedure
Example is included in the example directory. It holds numerous shell commands for communicating with the modem.
The example uses the generic gsm module for communicating with the modem. And due to the generic nature, it doesn't know how to power up the modem (which is also specific for different modems). So it has to be powered manually. Specific implementations hold these power up sequences.
Issues/PRs references
#8943