Regarding LPC 54018 module.

cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding LPC 54018 module.

1,284 Views
tanmayparashar9
Contributor I

Hello,

I am currently working with the LPC 54018 IoT module, Alexa and AWS. I am able to debug the code and it is working fine. (Debugs until the part which says use the mobile app to turn ON/OFF the LED). I have also created a function on AWS lambda and have mapped the ARN with my skill on Alexa skills kit. I have created a thing on AWS-IoT and have entered the endpoint in my code. The certificates have also been generated as per needed.  There are no errors/issues that I can see at the AWS lambda or the Alexa skills side.

The issue that I am facing is when I give an input to Alexa to toggle the LED, I get a response as (The LED is OFF) in all the cases. I am not understanding what do I need to fix?

Can you please help me out in understanding where the issue is?

Thank You!

Regards,

Tanmay

Labels (1)
Tags (1)
0 Kudos
17 Replies

461 Views
tanmayparashar9
Contributor I

Hello,

Sure. I am waiting for your reply on the new thread opened up. 

https://community.nxp.com/thread/500602

Please help me out.

Thank You

Regards,

Tanmay

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank you for your help. The LED demo is now working fine.

In this case when I say Alexa, ask my home to turn on/off the LED, the LED is turned on or off.

If I had to work on a particular application for example I say ( Alexa, ask my home to call the drone) and when I say this I wanted to enable one of the GPIO pins of the LPC module to go high/1 on receiving this input from Alexa.

Where all do I need to make changes on the coding side?

Is executing this particular application achievable and how do I do it?

Could you please help me out?

Thank you

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay,

I am glad to hear that your problem was resolved and it is working now. 

Regarding your other question 

If I had to work on a particular application for example I say ( Alexa, ask my home to call the drone) and when I say this I wanted to enable one of the GPIO pins of the LPC module to go high/1 on receiving this input from Alexa.

I will continue the support in the new thread that you opened. 

https://community.nxp.com/thread/500602

Best Regards,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Initially I used to get a response saying that the LED is OFF. I have attached screenshots in the earlier message.

Now, when I am trying to test the LED using alexa simulator I am getting something like this.

pastedImage_1.png

I have followed everything as in the lab manual and the steps you had mentioned above.

What do I do now?

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay,

Firstly, based on our companies policies I cannot take your log in credentials. 

I have now successfully replicated the project from my side and am able to turn on and off the led using Alexa. However checking all your information with detail, I noticed that the name of your Thing in MCUXpresso is 'myHomething' and in your lambda function that you provided in this thread you are saying 'myLEDthing', so that is an important difference. 

pastedImage_1.png

pastedImage_2.png

With that being said your certificates will also not match what it should be.

So now here are a couple things you need to verify and provide screenshots:

1. Make sure the name of your thing is the same in your MCUXpresso application and in your lambda function.

2. Also verify that in the aws_clientcredentials.h, the clientcredentialMQTT_BROKER_ENDPOINT has the correct url. This is located in your Thing -> Interact

2. Now download the thing's credentials keys again, so you can regenerate the aws_clientcredentials_keys.h. From your thing click on the security tab and detach both existing credentials. Then click create certificate again, so you can download the private key and the certificate for your thing and click activate.

pastedImage_8.png

Here you can follow the directions from your lab so you can regenerate the aws_clientcredentials_keys.h file and copy it to your project, save and build.

3. Next Verify that in the Alexa Skill Kit on your lambda your skill ID is enabled and matches your skill's endpoint.pastedImage_15.pngpastedImage_16.png

4. Lastly make sure your skill has the correct Lambda URL.

Once you have verified all these key sections build and run your program again. Please check to make sure your serial window looks similar to mine, of course specific details should match your own.

pastedImage_1.png

Let me know your results,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank you for your response.

I am still getting a response as LED is OFF

I followed everything as above and here are the screenshots

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

I was testing it using alexa simulator and this is what i got:

pastedImage_5.png

How do I fix this?

Should I provide you with my login credentials?So you would be able to test this on your end as well!

Thank You.

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay, 

   Thank you for the information this helps me alot. At the moment I'm recreating exactly what you have done following the lab you shared with me. One thing that popped out at me is the main screenshot of your lambda. Yours is different from the one I created. On yours you have the Amazon FreeRtos (which does not contain the correct permissions you need), it should be the Amazon CloudWatch Logs.

So I recommend creating the lambda function again following these instructions and the screenshots I have provided:

From Services > Compute > Lambda:

1. Create a new function:

pastedImage_3.png

2. Click Author from scratch, type in the name of your lambda function and choose python 3.6

pastedImage_5.png

3. Open the choose or create an execution role and make sure the execution role is the one shown below and at the bottom of the screen it shows that your lambda function with permissions to upload logs to Amazon Cloud watch Logs.

pastedImage_6.png

 

Once you have created your lambda. Click on the “Amazon CloudWatch Logs” icon and scroll down to the “Amazon CloudWatch Logs” section. Click on the “Manage these permissions” link. This will take us to the IAM console, where we can assign the permissions to our NXPLambdaFunction role.pastedImage_7.png

 Click on “Attach policies” button.

pastedImage_12.png

Type “awsiotfull” in the filter.

Select the “AWSIoTFullAccess” policy.

Click on the “Attach policy” button.

pastedImage_13.png

Verify that your role has now two policies: the AWSLambdaBasicExecutionRole and the AWSIoTFullAccess policies.

 pastedImage_14.png

Go back to your NXPLambdaFunction and verify that you now has “AWS IoT” resource available for your Lambda function.

pastedImage_15.png

Scroll down and locate the editable function code window and erase the preconfigured code.

Copy-paste the content of lambda script code into code window.

Lastly configure the timeout to be 10 sec

pastedImage_16.png

Make sure you copy correctly the new ARN of your Lambda Function to your skill.

Let me know the results of these changes,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank you for your reply.

1) Now I am using SDK 2.5.0

2) Here are the following screenshots:

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

Path-

IAM- roles ( lambda_basic_execution1)- policies- AWSIOTFullAccess

Does this help?

Regards,

Tanmay

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank You for the information.

To answer each of your questions,

1)Can you confirm the SDK version you are using?

 SDK version 2.3.1

2) Can you share the output in your serial terminal when you run the program? Here is an example.

I have attached a word document here which has the screenshots of the outputs on my serial terminal.

3) Are you able to control the LED using the android application?

Sorry I haven't worked on the android application as it was an optional part. I don't have an android phone either.

4) Are you hable to control the LED writing directly in the shadow? An example is shown below:

Yes I am able to control the LED by writing into shadow.

~Under desired state when I change it to 1, I get the reported state as 1 and the LED glows and for 0 i get 0 and the LED is turned off.

Also,

I am using Alexa simulator to test the on board LED. Whenever I say " ALEXA ask my home to turn on/off the LED" I get a response which says the LED if OFF in both the cases.

A message like this pops up- " Error retrieving device rendering- The object provided is not a valid template

I have attached a screenshot of this part as well.

Looking forward for your reply at the earliest.

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Tanmay,

First I would highly recommend downloading the latest SDK as there are some known bugs with that version. However because you are able to control the LED directly with the shadow, I would like to check your policy first.

Can you please share some screenshots of your Lambda's Function main screen right before you can edit the content. Like this imagepastedImage_1.png

Next click on AWS IoT then Manage Permissions then Roles and select the created role, for example lambda_basic_execution.

Can you show me a screenshot of the page when you get here. You should see AWSIoTFullAcess policy. If so can you click on the policy so we can see the content.

Thank you,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello

I have attached a word document here. This has screenshots of the AWS lambda and Alexa Skills page. It also has the Lambda and JSON script that I have used.

Also I had an other question-

Is it necessary that Alexa skills and AWS-Lambda/IOT should be having the same user login credentials?

I am accessing Alexa skills with one account having specific login ID and password example (ABC@gmail.com) and AWS console with an other account having an other set of login ID and password ( XYZ@gmail.com)

I am mapping the ARN and Skill ID from the two platforms.

Let me know if that is an issue.

Also, if you need the login credentials to look into it further, I can also provide you with those. 

Thank You!

Warm Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay,

Thank you for the information. To answer the last question, the credentials are different in Alexa skills and AWS-Lambda/IOT, as they are different platforms, so it is not an issue.

I have some new questions:

1)Can you confirm the SDK version you are using?

2) Can you share the output in your serial terminal when you run the program? Here is an example.

pastedImage_1.png

3) Are you able to control the LED using the android application?

4) Are you hable to control the LED writing directly in the shadow? An example is shown below:

pastedImage_3.png

Let me know the results.

Thank you,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank you for your response.

1)Based on the demo you are using the LED is initialized to be turned off, so when you power on the board and run the application the LED will remain off until you state otherwise.

-So should I initialize the LED to be turned on? Also I wanted to know that the LED example that I am using is correct right? Are there any issues with that?

2) As you stated that you are receiving responses, the cause will not be in the demo application nor the communication with your device. If you could please send me the content of your lamdba as well as your Alexa skill, that would be great.

This way I can continue to provide support and find the root cause.

 -I can see successful connections when I check on AWS-IOT which seems like the endpoint API that I have entered in the code is right and it is successfully able to send messages to AWS-IOT.

For AWS-Lambda and Alexa Skills what information do you need from my end? Do you need my login credentials for these platforms? I can provide you with those if needed.

Please let me know whatever you need and I can provide you with all the information.

Thank you.

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay, 

1) It is not necessary to change the LED initialization. If you would like to check to make sure the LED is working you can do a simple toggle after it is initialized.The example is ok and there are no issues.

2) It is not necessary to send me your credentials, can you please copy the lambda and alexa skill on a word document and attach it here.

I´ll be waiting for your response.

Thank you,

Sabina

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Tanmay,

To answer you question: Also, my on board LED does not light up in any case. It is always OFF. Ideally when I power up the board the LED should glow right?

-Based on the demo you are using the LED is initialized to be turned off, so when you power on the board and run the application the LED will remain off until you state otherwise.

As you stated that you are receiving responses, the cause will not be in the demo application nor the communication with your device. If you could please send me the content of your lamdba as well as your Alexa skill, that would be great.

This way I can continue to provide support and find the root cause.

Thank you,

Sabina

0 Kudos

461 Views
tanmayparashar9
Contributor I

Hello,

Thank you for your response.

 

The project that I am trying to run is a simple LED program. I have attached the program folder to this question. That is the program I am trying to run

 

This is what I can see at under shadow corresponding to my thing:

 

{   "desired": {     "LEDstate": 0   },   "reported": {     "LEDstate": 0   } }

 

Also, my on board LED does not light up in any case. It is always OFF. Ideally when I power up the board the LED should glow right?

 

I am not trying to understand where the issue is..

 

Thank You

 

Regards,

Tanmay

0 Kudos

461 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Tanmay,

My name is Sabina and I will be helping you find a solution to the behavior you are experiencing.

First I would like to know if you are using a demo project or if you created the project?

When you say that you get a response that the LEDs are off, this sounds to me that you are establishing a connection with your device. So my questions here are:

Can you check and verify the before and after of your Thing's Shadow to see if the activity is reflected?

Also, does the physical LED on your board toggle even though it responds that is off or is the actual LED unresponsive as well?

Let me know the information,

Thank you!

Sabina

0 Kudos