832 views
in System Integration by
Hi

I'm using the Raspberry Pi 3 to run example " DeviceIntegration", but  the external elements(LED and button) don't respond, only the button to send the string work

1 Answer

+1 vote
by
 
Best answer

Hi,

have you installed the WiringPi library? Have you connected your LED and button correctly? Does your LED work with a simple WiringPi test?

Best regards,

Manfred.

by
Yes, I installed the library on the Raspberry Pi, the LED and the button are connected correctly, and I tested the example blink.c that works fine.

 

It is necessary to add the library in the block "Inline" in Application ?

How can I know if the GUI is calling Wiring Pi?
by
The example "DeviceIntegration" is already prepared to work with the WiringPi library - there is no need to change the project.

You can try to place some printf() messages to check if the initailization of the GPIOs is called. Additionally, you can place a printf() to check when the LED state should change in order to ensures that it is triggered from the GUI software. I assume this is working, because the "Hello World" string also appears when the button is pressed.
by

Hi Manfred

I have not managed to turn on the led from the GUI, I am using WiringPi 2.5, could you help me, on how can I set another pin to high?

 

That is the answer of the make

 

root@raspberrypi:/home/pi/share/Application/Project# make
-------------------------------------------------
Creating EmbeddedWizard-RasPi-3B
-------------------------------------------------
Compiler Options: cc -c -MT projectecho -MMD -MP -MF projectecho.d -O2 -Wall -pipe -I../Source -I../GeneratedCode -I../../PlatformPackage/RTE -I../../PlatformPackage/RGBA8888 -I../../TargetSpecific -I/usr/include -I/opt/vc -I/opt/vc/include -o projectecho
-------------------------------------------------
Creating object and library directories
-------------------------------------------------
Linking EmbeddedWizard-RasPi-3B
cc -L/opt/vc/lib ./obj/main.o ./obj/ewmain.o ./obj/DeviceDriver.o ./obj/Core.o ./obj/Effects.o ./obj/Graphics.o ./obj/Resources.o ./obj/Views.o ./obj/WidgetSet.o ./obj/Application.o ./obj/ew_bsp_display.o ./obj/ew_bsp_touch.o ./obj/ew_bsp_console.o -L../../PlatformPackage/RTE -L../../PlatformPackage/RGBA8888 -lm -lbcm_host -lbrcmGLESv2 -lbrcmEGL -lpthread -lewrte -lewgfx -lwiringPi -o ./EmbeddedWizard-RasPi-3B
EmbeddedWizard-RasPi-3B successfully built !!
root@raspberrypi:/home/pi/share/Application/Project# ./EmbeddedWizard-RasPi-3B
Initialize EGL / OpenGL ES 2.0...            [OK]
Initialize Graphics Engine...                [OK]
Create EmWi Root Object...                   [OK]
Create EmWi Viewport...                      [OK]
Open Touch Driver...                         [OK]
Start Touch Event Thread...                  [OK]
Start EmWi Main Loop...                      [OK]
The string is: Hello World
The string is: Hello World
Terminate EmWi Main Loop...                  [OK]
Shut-down EmWi application and OpenGL...     [OK]
 

by

Hello,

please add the following EwPrint() statements into the original DeviceDriver.c file:

Within DeviceDriver_Initialize():

and within DeviceDriver_SetLedStatus():

Now let me know if you get some outputs on the console when you press the LED checkbox...

Furthermore, can you post a photo of your LED and button connection to your board?

Best regards,

Manfred.

by

Hello

I get "digitalWrite () called ..." when I press the LED box, but I do not receive that "wiringPiSetup() called..." has been initialized.

 

I have made a code in C just to check the operation of the pins and it works correctly, they are the same pins as in example DeviceIntegration.

Wire 

Red --> 3.3v

Brown --> GND

Orange -->  GPIO 0 (wPi)

Gray --> GPIO 3 (wPi)

by
Does this mean that wiringPiSetup() is not called? Then this could be the reason for the problem.

Please verify that DeviceDriver_Initialize() is called from ewmain.c.
by
Yes, DeviceDriver_Initialize() doesn't start, I just noticed it because the message to end the execution with the P key does not appear , how can I repair that?
by

Hi Manfred

I found the problem

Let me explain, start by downloading Embedded Wizard and then the Raspberry Pi Platform Package.
I connected my raspberry to a shared folder and started trying to understand the operation of the software looking at the examples, but the touch of the screen did not work since I am using a 5-inch display with connection through HDMI and SPI, so I started looking for information about it and I found this https://ask.embedded-wizard.de/1148/touchscreen-is-not-working where I downloaded the main.c from https: //ask.embedded-wizard. from /? qa = blob & qa_blobid = 2595273799886290585 then with the examples like ChartsDemo it works perfectly.

 

I thought the downloaded main.c had what it needed to run the other examples, so I didn't check it until I noticed that it didn't compile the other attributes.

I suppose the solution is to remove the code related to the display driver, could you help me by telling me how to do it?

by

So the questuin is how can i fix the main.c (https://ask.embedded-wizard.de/?qa=blob&qa_blobid=2595273799886290585)  to work with the DeviceIntegration example?

 

It is because it does not initialize the Embedded Wizard application? with EwInit()?

Or because it's not being called EwProcess()?

 

by
Hello,

o.k. the origin question was "Raspberry Pi Example DeviceIntegration doesn't work..." - now, we know that you have modified the main.c file.

Please note, that the main.c that you found in some other answer was uploaded in 2017 for some older version. Meanwhile the entire structure of our Build Environment has changed and enhanced - e.g. to simplify the integration of devices...

Please take the original Build Environment for Raspberry Pi and then you will see that the Device Integration example works fine. If you need some adaptations because of your display or touch, please make these changes within the corresponding module (/TargetSpecific/ew_bsp_display.c or ew_bsp_touch.c).

Best regards,

Manfred.
by
Hello

Thanks for your comment Manfred.

Ok, checked the file w_bsp_touch.c and print the coordinates, it only recognizes the touch of the upper left corner.

---------------------------------------------
Touch event for finger 0 with state 1 (  233,  475 )
Touch event for finger 0 with state 2 (  235,  473 )
Touch event for finger 0 with state 2 (  236,  480 )
Touch event for finger 0 with state 3 (  236,  480 )
Touch event for finger 0 with state 1 (  227,  480 )
Touch event for finger 0 with state 2 (  236,  473 )
Touch event for finger 0 with state 2 (  225,  480 )
Touch event for finger 0 with state 2 (  223,  474 )
Touch event for finger 0 with state 2 (  234,  469 )
Touch event for finger 0 with state 2 (  227,  469 )
Touch event for finger 0 with state 2 (  228,  476 )
Touch event for finger 0 with state 2 (  236,  473 )
Touch event for finger 0 with state 3 (  236,  473 )
Touch event for finger 0 with state 1 (  442,  471 )
Touch event for finger 0 with state 2 (  443,  480 )
Touch event for finger 0 with state 2 (  442,  480 )
Touch event for finger 0 with state 2 (  448,  478 )
Touch event for finger 0 with state 3 (  448,  478 )
Touch event for finger 0 with state 1 (  446,  476 )
Touch event for finger 0 with state 3 (  446,  476 )
Touch event for finger 0 with state 1 (  435,  480 )
Touch event for finger 0 with state 3 (  435,  480 )
Touch event for finger 0 with state 1 (  356,  475 )
Touch event for finger 0 with state 2 (  356,  470 )
Touch event for finger 0 with state 2 (  348,  475 )
Touch event for finger 0 with state 2 (  351,  476 )
Touch event for finger 0 with state 2 (  355,  471 )
Touch event for finger 0 with state 2 (  356,  465 )
Touch event for finger 0 with state 2 (  348,  474 )
Touch event for finger 0 with state 2 (  353,  473 )
Touch event for finger 0 with state 2 (  347,  480 )
Touch event for finger 0 with state 2 (  349,  480 )
Touch event for finger 0 with state 2 (  358,  467 )
Touch event for finger 0 with state 3 (  358,  467 )
Touch event for finger 0 with state 1 (  289,  479 )
Touch event for finger 0 with state 3 (  289,  479 )
Touch event for finger 0 with state 1 (  285,  479 )
Touch event for finger 0 with state 3 (  285,  479 )
 

I use a 5-inch display with 800x480 resolution

How can I solve that?
by

Maybe it is the easiest, when you compare the touch detection from your working main.c file with the touch detection of the current ew_bsp_touch.c implemenation. It assume that your touch driver provides the values with some offset and scaling.

The current touch coordinates are used as they are:

        if ( code == ABS_MT_POSITION_X )
          touchX = value;
        else if ( code == ABS_MT_POSITION_Y )
          touchY = value;

 

Now you can add your offset/scaling:

        if ( code == ABS_MT_POSITION_X )
          touchX = ( TouchAreaWidth * ( 
value - X_MIN )) / ( X_MAX - X_MIN );
        else if ( code == ABS_MT_POSITION_Y )
          touchY = ( TouchAreaHeight * ( value - Y_MIN )) / ( Y_MAX - Y_MIN );

(Remark: This code is not tested - it is based on the main.c that you have referred....)

Best regards,

Manfred.

 

by
Thank you very much for all your help Manfred.

It works correctly.
by
Great! Thank you!

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...