-
Notifications
You must be signed in to change notification settings - Fork 3k
Cellular: Telit ME910 driver #10484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cellular: Telit ME910 driver #10484
Conversation
@loverdeg-ep |
@trowbridgec, thank you for your changes. |
protected: // AT_CellularDevice | ||
virtual uint16_t get_send_delay() const; | ||
virtual nsapi_error_t init(); | ||
virtual nsapi_error_t hard_power_on(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be implemented if defined, or if don't have the default power implementation the declaration of power-functions should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AriParkkila I added the default power implementation for the ME910. I was toying around with this since we have a separate, board-specific power enable pin that I had to accommodate, but that functionality doesn't make sense here (should be in our application/BSP code), so now I just have the necessary power on sequences as suggested in the ME910 manual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AriParkkila I see that a couple of the CI jobs are failing because my power implementation references the MDMPWRON
pin:
[Error] TELIT_ME910.cpp@95,29: 'MDMPWRON' was not declared in this scope
[Error] TELIT_ME910.cpp@109,29: 'MDMPWRON' was not declared in this scope
Is there a recommended way to handle this? Use a #if check for the MDMPWRON
pin? Use a #if check for MODEM_ON_BOARD
?
Is it better to just use the default power implementation here in the driver and leave it up to the end user to implement this in an onboard_modem_api.c
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trowbridgec can you follow the implementation from EC2X.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trowbridgec You should declare the pins as class variables, e.g. TELIT_ME910.h
:
bool _active_high;
DigitalOut _pwr;
DigitalOut _rst;
And then use the variables instead of compile-time defines, e.g. TELIT_ME910.cpp
:
nsapi_error_t TELIT_ME910::hard_power_on()
{
if (_pwr.is_connected()) {
_pwr = _active_high;
In addition, the pins need to be provided in the class constructor.
@AriParkkila Any further recommendations to get this merge-able? |
@AriParkkila could you re-review this please? |
@trowbridgec the pins should be defined similar to that in EC2X, see how the class constructor takes pins and power functions use those as member variables. |
d968dab
to
0a717e4
Compare
…tom get_context() function
@AriParkkila Thanks for your help on this! I implemented the changes you asked for; please review! |
|
||
_at.resp_stop(); | ||
if (_cid == -1) { // no suitable context was found so create a new one | ||
if (!set_new_context(1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function could probably be removed? This line seems to be the only diff to parent implementation, and this is likely incorrect, this should use _cid after the last in use, see parent implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being able to write a custom version of the get_context()
function for this driver was the motivation for PR #10442. This function has 2 slight modifications from what's in AT_CellularContext.cpp
:
- The modified
if
statement in the comment above. - If we can't find a good APN candidate, the logic that seems to work best for this module is to just use context 1 instead of creating a 7th (which is not allowed).
features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularContext.cpp
Show resolved
Hide resolved
features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp
Outdated
Show resolved
Hide resolved
features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp
Outdated
Show resolved
Hide resolved
// +CGREG:<stat>[,[<lac>],[<ci>],[<AcT>],[<rac>][,,[,[<ActiveTime>],[<PeriodicRAU>],[<GPRSREADYtimer>]]]] | ||
// Current setting: enable the network registration unsolicited result code, and selects the | ||
// short format | ||
_at->cmd_start("AT+CGREG=1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be removed, as it will be overridden by cellular_properties
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp
Outdated
Show resolved
Hide resolved
@ARMmbed/mbed-os-maintainers Any guidance you can provide with the copyright texts. |
if (pdp_type_len > 0) { | ||
apn_len = _at.read_string(apn, sizeof(apn) - 1); | ||
if (apn_len >= 0) { | ||
if (_apn && apn_len > 0 && (strcmp(apn, _apn) != 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modified version of the get_context()
function adds a check here to only skip over (i.e. continue
) a candidate APN if it's string length is greater than 0 (i.e. it's not an empty string).
Original:
if (_apn && (strcmp(apn, _apn) != 0)) {
continue;
}
Modified:
if (_apn && apn_len > 0 && (strcmp(apn, _apn) != 0)) {
continue;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So even if _apn has been defined you wan't to accept an pdp context with empty apn if context matches by pdp type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarvte The initial motivation for this change was a scenario that I saw with this module where 6 contexts were already defined (based on the return value from the AT+CGDCONT?
command), but all 6 had an empty-string APN. The logic of the current function would reject all 6 of the contexts (because it doesn't exactly match the target APN), and would therefore try to create a new, 7th context which would be denied by the module (it only supports 6 contexts).
I proposed changing the logic of the get_context()
function to NOT skip over a context with an empty-string APN (i.e. ONLY skip over a context if it has a non-empty-string APN that DOESN'T match the target APN).
Sorry if I'm explaining this poorly; see PR #10442 for more info.
Bump |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Add support for the Telit ME910 CAT-M1 cellular module.
See #8666 for more history on this issue.
Pull request type
Reviewers
@hasnainvirk @AriParkkila @maclobdell @ARMmbed/mbed-os-wan
Release Notes