Android 9 Vehicle Driver to Vehicle HAL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android 9 Vehicle Driver to Vehicle HAL

Jump to solution
11,978 Views
vinothkumars
Senior Contributor IV

Dear NXP,

I am working on iMX8 with Android P Automotive. I confused with value mentioned in the following file.

Could you explain the following content (mentioned in bold) and let me know for adding new parameter and adding values.

source/vendor/nxp-opensource/kernel_imx/drivers/mxc/vehicle/vehicle_core.h

#ifdef CONFIG_VEHICLE_DRIVER_OREO
#define HVAC_FAN_SPEED 306185472
#define HVAC_FAN_DIRECTION 306185473
#define HVAC_AUTO_ON 304088330
#define HVAC_AC_ON 304088325
#define HVAC_RECIRC_ON 304088328
#define HVAC_DEFROSTER 320865540
#define HVAC_TEMPERATURE_SET 308282627
#define HVAC_POWER_ON 304088336
#else
#define HVAC_FAN_SPEED 356517120
#define HVAC_FAN_DIRECTION 356517121
#define HVAC_AUTO_ON 354419978
#define HVAC_AC_ON 354419973
#define HVAC_RECIRC_ON 354419976
#define HVAC_DEFROSTER 320865540
#define HVAC_TEMPERATURE_SET 358614275
#define HVAC_POWER_ON 354419984
#endif

Thanks & Regards,

VinothS

Regards,
Vinothkumar Sekar
1 Solution
10,535 Views
vinothkumars
Senior Contributor IV

This is the problem with emulator. I closed this thread now.

Regards,

VinothS

Regards,
Vinothkumar Sekar

View solution in original post

0 Kudos
Reply
26 Replies
9,222 Views
shriyanayak1992
Contributor II

Hi vinothkumars‌,

I went through vehicle Hal, It says vehicle HAL is connected to an emulator instead of a real vehicle network. I dont see any implementations wrt to communication with CAN.

Is there a way Vehicle HAL can receive CAN commands and send it up to application? I want this in cortex A35 .I dont want to move can to M4. I have tested CAN on IMX8 using canutils.

Regards,
Sriraksha

0 Kudos
Reply
9,222 Views
vinothkumars
Senior Contributor IV

Hi,

Physical CAN communicate with Vehicle HAL via Emulator only and the Callbacks called by CAR service from Emulator

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,222 Views
shriyanayak1992
Contributor II

Hi vinothkumars‌,

Physical CAN communicate with Vehicle HAL via Emulator only and the Callbacks called by CAR service from Emulator.

Could you be elaborate or give more insight into this?

I went through the code but couldn't find any code related to CAN communication with HAL via Emulator.

I also saw your post on sending CAN data to HAL. How are you sending this? 

Problem in sending Int array vehicle data 

Regards,
Sriraksha

0 Kudos
Reply
9,218 Views
vinothkumars
Senior Contributor IV

Hi,

You needs to port CAN driver in M4 SDK Code,

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,218 Views
shriyanayak1992
Contributor II

Hi vinothkumars‌,

Thank you. I wanted to try without porting can to M4. Isn't it possible in cortex a35?

I was thinking as canutils talk to can driver and dump messages cant I do the same dumping & sending it to vhal?

I am want to send dummy data from VHAL to car services up to application?

Any examples or pointers to this?

Regards,

Sriraksha

0 Kudos
Reply
9,218 Views
vinothkumars
Senior Contributor IV

Hi,

By default CAN communication needs M4 MCU (rpmsg)

Check dts file,

      source/vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale

You can use dumpsys commands to simulation purpose,

Regards,

VinothS,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,218 Views
shriyanayak1992
Contributor II

Hi vinothkumars

Thank you.

Any idea on when will default implementation ie vehicle emulator called ? /hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/

I have manually started the service./vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service       
Logs as below: 

05-14 09:06:03.348 4893 4893 I VehicleEmulator_v2_0: registerEmulator, emulator: 0xe3b636c0d380
05-14 09:06:03.349 4893 4893 I VehicleEmulator_v2_0: Starting SocketComm
05-14 09:06:03.349 4893 4893 I automotive.vehicle@2.0-impl: VehicleHalManager::init
05-14 09:06:03.351 4893 4893 I automotive.vehicle@2.0-service: Registering as service...
05-14 09:06:03.353 1772 1772 W hwservicemanager: Detected instance of android.hardware.automotive.vehicle@2.0::IVehicle (pid: 4893) registering over instance of or with base of android.hardware.automotive.vehicle@2.0::IVehicle (pid: 1901).
05-14 09:06:03.354 4893 4893 I ServiceManagement: Registered android.hardware.automotive.vehicle@2.0::IVehicle/default (start delay of 70ms)
05-14 09:06:03.354 4893 4893 I ServiceManagement: Removing namespace from process name android.hardware.automotive.vehicle@2.0-service to vehicle@2.0-service.
05-14 09:06:03.355 4893 4893 I automotive.vehicle@2.0-service: Ready

I dont see any logs from SocketComm or any communication happening?
Am i missing something?

Regards,

Sriraksha

0 Kudos
Reply
9,222 Views
vinothkumars
Senior Contributor IV

Yes some what you missing here.

Provide your build steps.

Are you able to open Kitchen Sink Application ?

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,203 Views
shriyanayak1992
Contributor II

Hi vinothkumars‌,

 Yes i was able to run kitchen sink app application and look into different menu like VHAL or property etc. But none of the calls were made to this vehicle emulator here  /hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/. I dint see any logs from vehicle service 

(/vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service)

when Kitchen sink app is running.

Build steps:

source build/envsetup.sh

lunch mek_8q_car-userdebug

./imx-make.sh -j4 

for any changes in modules i use mma.

I read that SocketComm opens a socket, and listens for connections from clients. Typically the client will be
adb's TCP port-forwarding to enable a host PC to connect to the VehicleHAL. So what basically is it reading from adb? 

I am getting confused here.Currently SocketComm thread is not started at all. I dont see any logs from it.

Regards,
Sriraksha

0 Kudos
Reply
9,189 Views
vinothkumars
Senior Contributor IV

Hi,

for example PERF_VEHICLE_SPEED

Open the KitchenSink application -> select property tab -> enable PERF_VEHICLE_SPEED

send the following command from terminal,

     dumpsys activity service com.android.car inject-vhal-event 0x11600207 23

Provide your full log also

VinothS,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,189 Views
shriyanayak1992
Contributor II

Hi vinothkumars‌,

  dumpsys activity service com.android.car inject-vhal-event 0x11600207 23

what are those numbers in the above command?

This is the log when i do a dumpsys after selecting perf_vehicle_speed

rvice com.android.car inject-vhal-event 0x11600207 23 <
SERVICE com.android.car/.CarService 902335a pid=2237
Client:

SERVICE com.android.car/.PerUserCarService dd2644b pid=3192
Client:
nothing to dump

SERVICE com.android.car.hvac/.HvacController c0ac038 pid=2640
Client:
nothing to dump

SERVICE com.android.car.hvac/.HvacUiService d9977f9 pid=2640
Client:
nothing to dump

SERVICE com.android.car.messenger/.MessengerService ddd9f33 pid=3368
Client:
nothing to dump

 i have attached complete log and screenshot as well.

thumbnail_IMG_20200515_162732.jpg   

0 Kudos
Reply
9,189 Views
vinothkumars
Senior Contributor IV

Hi,

This the message id and it's defined in types.hal

/**
* Speed of the vehicle
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
* @access VehiclePropertyAccess:READ
* @unit VehicleUnit:METER_PER_SEC
*/
PERF_VEHICLE_SPEED = (
0x0207
| VehiclePropertyGroup:SYSTEM
| VehiclePropertyType:FLOAT

| VehicleArea:GLOBAL),

0x11600207

1 -> SYSTEM = 0x10000000,

1 -> GLOBAL = 0x01000000,

60 -> FLOAT = 0x00600000,

207 -> Alternative numaber

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
9,189 Views
shriyanayak1992
Contributor II

hi vinothkumars‌,

Thank you.

Did you find anything from the logs ?why there are no dumps related to vehicle speed?

Regards,
Sriraksha 

0 Kudos
Reply
9,189 Views
vinothkumars
Senior Contributor IV

Hi I will update later.

VinothS,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,222 Views
krishnan_ramesh
Contributor III

hi vinothkumars‌,

May I know how and where did u add new vehicle parameters?

And how did u verify the communication between M4 to CAN bus?

Regards,
Ramesh

0 Kudos
Reply
9,222 Views
vinothkumars
Senior Contributor IV

Please find the below reference link,

android - AOSP: How to initialize the VehicleProperty::AUDIO_VOLUME property (.initialValues in the ... 

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
9,222 Views
krishnan_ramesh
Contributor III

Hi vinothkumars‌,

Thank you for sharing it.

How do we test the vehicle property added?

Any idea of running vehicle hal test found here

<sources>packages/services/Car/tests/vehiclehal_test

or

running emulator in 

<sources>/hardware/interfaces/automotive/vehicle/2.0/default/tests

Regards,

Ramesh

0 Kudos
Reply
9,222 Views
vinothkumars
Senior Contributor IV

We have kitchensink Application and this is the command used for launch the kitchensink application,

Path: packages/services/Car/tests/EmbeddedKitchenSinkApp

commands,

   am start -n com.google.android.car.kitchensink/com.google.android.car.kitchensink.KitchenSinkActivity

Note: Check Android User Guide for build with M4 as well without M4

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos
Reply
9,222 Views
yifei_ren
Contributor III

Those values are property ID.

Android APP - > Android FW ->  VHAL- > Kernel -> M4, all using the same ID.

0 Kudos
Reply
9,222 Views
vinothkumars
Senior Contributor IV

Hi yifei.ren@hirain.com‌ ,

Could you tell me, how vehicle data flow from M4 to CAN Bus ?

And also I got error, When I send the following command,

echo 2 > /sys/devices/platform/vehicle-dummy/hvac_on

Unable to handle kernel NULL pointer dereference at virtual address 000000171

After Kernel crashed and reboot.

Thanks,

VinothS,

Regards,
Vinothkumar Sekar
0 Kudos
Reply