Skip to content
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

Issue 131: Add BNO055, RF430CL331H, update BME680, IS25xp #132

Merged
merged 10 commits into from
Jul 30, 2024

Conversation

HToshani
Copy link
Contributor

@HToshani HToshani commented Jul 11, 2024

  • BNO055 and RF430CL331H source and header files and related code in boot.s and warp.h added.

  • Added new function to get the state of BME680

  • Added new functions to push and release IS25xp from a deep power-down state.

  • Pushed all components to sleep mode here
    `#if (WARP_BUILD_ENABLE_GLAUX_VARIANT && WARP_BUILD_BOOT_TO_CSVSTREAM)
    warpScaleSupplyVoltage(3300);
    int timer = 0;
    int rttKey = -1;

    bool _originalWarpExtraQuietMode = gWarpExtraQuietMode;
    gWarpExtraQuietMode = false;
    releaseDeepPowerModeIS25xP();
    warpPrint("Press any key to show menu...\n");
    gWarpExtraQuietMode = _originalWarpExtraQuietMode;

    while (rttKey < 0 && timer < kWarpCsvstreamMenuWaitTimeMilliSeconds)
    {
    rttKey = SEGGER_RTT_GetKey();
    OSA_TimeDelay(1);
    timer++;
    }

    if (rttKey < 0)
    {
    printBootSplash(gWarpCurrentSupplyVoltage, menuRegisterAddress, &powerManagerCallbackStructure);

      warpPrint("About to loop with printSensorDataBME680()...\n");
      while (1)
      {
      	blinkLED(kGlauxPinLED);
      	for (int i = 0; i < kGlauxSensorRepetitionsPerSleepIteration; i++)
      	{
      		warpPrint("%d'n", i);
    

#if (WARP_CSVSTREAM_TO_FLASH)

			#if (WARP_BUILD_ENABLE_DEVIS25xP)
				/*
				*	Release the Flash from deep power-down
				*/
				releaseDeepPowerModeIS25xP();
				warpPrint("\r\n\tFlash status after releasing from deep power mode and before reading data from it\n");
				flashStatusIS25xP();
			#endif
			writeAllSensorsToFlash(0 /* menuDelayBetweenEachRun */, 0 /* loopForever */);

#else
printAllSensors(true /* printHeadersAndCalibration /, true / hexModeFlag /, 0 / menuDelayBetweenEachRun /, false / loopForever /);
#endif
}
#if (WARP_BUILD_ENABLE_DEVBME680)
warpPrint("About to configureSensorBME680() for sleep...\n");
status = configureSensorBME680( 0b00000000, /
payloadCtrl_Hum: Sleep /
0b00000000, /
payloadCtrl_Meas: No temperature samples, no pressure samples, sleep /
0b00001000 /
payloadGas_0: Turn off heater /
);
if (status != kWarpStatusOK)
{
warpPrint("configureSensorBME680() failed...\n");
}
StateBME680();
#endif
#if (WARP_BUILD_ENABLE_DEVBNO055)
configureSensorRegisterBNO055(0x00, 0x02);
StateBNO055();
#endif
#if (WARP_BUILD_ENABLE_DEVRF430CL331H)
warpPrint("\r\n\tRF430CL control register status before going to standby mode\n");
StatusRF430CL331H();
configureSensorRegisterRF430CL331H(0x0040);
warpPrint("\r\n\tRF430CL control register status after going to standby mode\n");
StatusRF430CL331H();
#endif
#if (WARP_BUILD_ENABLE_DEVIS25xP)
/

* Put the Flash in deep power-down
*/
deepPowerModeIS25xP();
if (status != kWarpStatusOK)
{
warpPrint("\r\n\tError: communication failed");
}
warpPrint("\r\n\tFlash status after going into low power mode\n");
flashStatusIS25xP();
#endif

		warpDisableI2Cpins();
		blinkLED(kGlauxPinLED);
		warpPrint("About to go into VLLS0...\n");
		status = warpSetLowPowerMode(kWarpPowerModeVLLS0, kGlauxSleepSecondsBetweenSensorRepetitions /* sleep seconds */);

		if (status != kWarpStatusOK)
		{
			warpPrint("warpSetLowPowerMode(kWarpPowerModeVLLS0, 10)() failed...\n");
		}
		warpPrint("Should not get here...");
	}
}

#endif`

******** bug ******************
To store correct BME680 results in the flash, temporarily comment sensorBitField for BNO055, RF430CL331H, and RV8803C7 in writeAllSensorsToFlash function in boot.c. Otherwise, it will store the wrong values. It's related to appendSensorDataBNO055, appendSensorDataRF430CL331H and appendSensorDataRV8803C7 functions.

`#if (WARP_BUILD_ENABLE_DEVBNO055)
numberOfConfigErrors += configureSensorRegisterBNO055(0x00, 0x02);

// sensorBitField = sensorBitField | kWarpFlashBNO055BitField;	

#endif #if (WARP_BUILD_ENABLE_DEVRF430CL331H)
numberOfConfigErrors += configureSensorRegisterRF430CL331H(0x0040);

// sensorBitField = sensorBitField | kWarpFlashRF430CL331HBitField;	

#endif #if (WARP_BUILD_ENABLE_DEVRV8803C7)
// sensorBitField = sensorBitField | kWarpFlashRV8803C7BitField;
#endif #if (WARP_BUILD_ENABLE_DEVBNO055)
// bytesWrittenIndex += appendSensorDataBNO055(flashWriteBuf + bytesWrittenIndex);
#endif #if (WARP_BUILD_ENABLE_DEVRF430CL331H)
// bytesWrittenIndex += appendSensorDataRF430CL331H(flashWriteBuf + bytesWrittenIndex);
#endif`

Closes #131.

@KomaGR KomaGR linked an issue Jul 11, 2024 that may be closed by this pull request
@KomaGR KomaGR changed the title Issue 131 Issue 131: Add BNO055, RF430CL331H, update BME680, IS25xp Jul 11, 2024
@KomaGR
Copy link
Member

KomaGR commented Jul 11, 2024

@janithpet Can you please take a quick look at this PR.

setup.conf Outdated Show resolved Hide resolved
tools/scripts/glaux.jlink.commands Outdated Show resolved Hide resolved
tools/scripts/warp.jlink.commands Outdated Show resolved Hide resolved
Copy link
Member

@KomaGR KomaGR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the removal of a lot of error handling in the flash driver. Is there a specific motivation behind this? (E.g., binary size.)

src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devIS25xP.c Outdated Show resolved Hide resolved
…reviewed code conventions for all sensors, compiled Glaux and Warp, tested BME680 with and without FLASH on Glaux.
src/boot/ksdk1.1.0/boot.c Outdated Show resolved Hide resolved
Copy link
Member

@KomaGR KomaGR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I made some suggestions related to code alignment.

src/boot/ksdk1.1.0/boot.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/boot.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/config.h Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBME680.c Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.c Outdated Show resolved Hide resolved
src/boot/ksdk1.1.0/devBNO055.h Outdated Show resolved Hide resolved
@KomaGR KomaGR merged commit 224966e into physical-computation:master Jul 30, 2024
1 check passed
@KomaGR
Copy link
Member

KomaGR commented Jul 30, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add BNO055 codes and also configuring the code for sleep mode
2 participants