Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

INA219 Sensor wrong data display

Hello Community,

I'm using the current sensor INA219 with NRF5340dk.
Communication is through i²c protocol and using nrf SDK v1.7.0 .
I'm trying to get the data output (Voltage, Current, Power).
i worked on the sample linked on Zephyr Lib. the problem is that i'm always getting the same output which i liked below

the wiring of the sensor is like below :

Vin->VDD nrf
GND->GND
SCL->P0.26
SDA->P0.25

I'm always getting the current and power to Null values and both voltage values don't change no matter what !
do i need to change the calibration values or do i need to do something else ?
i don't get what's wrong with the data output so i need your help please
can you help me get the right values and get the data displayed out from the sensor correctly, please

Kindly,
Many thanks
 

Parents
  • Hi,

    INA219 examle in Zephyr writes very strange (IMHO incorrect) value into configuration register. Try to replace it with default one:

    	/* Configurate the chip using default values */
    	data[0] = 0x39;
    	data[1] = 0x9f;

  • i already changed that before i putted the message on the forum 
    for now i changed the pins and changed my overlay file according to the new pin numbers 
    and i always took the comment of Dmitry in consideration and i changed the addresses and now it's being so strange 

  • It's could be a problem in the build folder, if you haven't deleted it in a while, so you can try deleting it and rebuilding.

    Did you reinstall the v1.8.0 SDK? If you did not, you can try that if deleting the build folder does not work. And like I said in my previous comment, make sure that it is completely finished installing before clicking any buttons.
    By reinstalling I mean removing it and then reinstalling:

  • yeah i did it 
    i removed and gave it the time to install correctly 
    i deleted the build folder 
    i figured out that i didn't add the DK on the plateform_allow in the sample.yaml 
    now after i added nrf5340dk_nrf5340cpuapp it works properly and it builds properly 

    sample:
      name: TI INA219 power/current monitor
      description: Demonstration of the INA219 I2C power/current monitor
    tests:
      sample.drivers.ina219:
        build_only: true
        platform_allow: nrf5340dk_nrf5340cpuapp blackpill_f411ce
        tags: sensors

    but when i try to debug it i have no output on the Terminal emulator 
    is there another trick to do to get the sensor data displayed please ? 
    do i need to activate something on the sensor ? 


    Kindly,
    Many thanks 

  • Try removing CONFIG_STDOUT_CONSOLE=y from prj.conf.

    If that doesn't fix it replace CONFIG_CBPRINTF_FP_SUPPORT=y with CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y.

  • i tried removing CONFIG_STDOUT_CONSOLE=y from prj.conf
    it didn't fix the problem 
    replaced CONFIG_CBPRINTF_FP_SUPPORT=y with CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y with CONFIG_STDOUT_CONSOLE=y being removed
    it didn't work neither 
    there's no output message on the the terminal 
    emulator

  • i deleted the build file between the two changes 
    to eliminate the probability of error 

    i even added some logs before and after this part 

    	if (!device_is_ready(ina)) {
    		printf("Device %s is not ready.\n", ina->name);
    		return;
    	}

    but none of these logs was displayed 

Reply
  • i deleted the build file between the two changes 
    to eliminate the probability of error 

    i even added some logs before and after this part 

    	if (!device_is_ready(ina)) {
    		printf("Device %s is not ready.\n", ina->name);
    		return;
    	}

    but none of these logs was displayed 

Children
No Data
Related