Regarding Battery status monitor via I2C

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

Regarding Battery status monitor via I2C

3,466 Views
PriyaMP
Contributor I

Dear All,

In our custom board we are using imxrt1050 and MAX17260.

MAX17260 used for monitoring the battery status and I2C lines are connected between MAx17260 and imxrt1050

I've modified the driver - evkbimxrt1050_lpi2c_interrupt_b2b_transfer_master, according to the datasheet of MAX17260.

PFA for the project

While debugging it results in SWD 0 devices detected.

Can any one pl guide??

I've put multiple debug points, in the main function.

While debug, it doesn't display the first print itself.

Kindly let me know where I've done a mistake.

 

 

Labels (1)
0 Kudos
Reply
13 Replies

3,462 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP 

    So, now your issues is the project can't enter the debug mode:SWD 0 devices detected, right?

  What's the IDE you are using? This issue is normally caused by the invalid app, then the SWD debugger will has issues, it can be resolved by erasing the external memory.

  You can try to download one other SDK working code, eg, helloworld, if still have this issues, enter serial download mode, then download the code, exit the code, you will find code is running, then change the mode back to internal boot mode, try to download the code again, you will find the debug works.

   Please try it on your side at first, if you still have questions about it, just kindy let me know.

   Next time, when you have issues, you also can attach some screenshot about it.

 

Best Regards,

kerry

0 Kudos
Reply

3,457 Views
PriyaMP
Contributor I

Dear Kerry,

Thank you for the response.

So, now your issues is the project can't enter the debug mode:SWD 0 devices detected, right?

No, I'm able to debug once or twice (with the debug not entering the main function) after that it enters into SWD 0 Devices detected.

What's the IDE you are using?

I'm using MCUXPRESSO 11.1.1 with SDK 2.7

Yes Kerry, I've been following the pdf Recover_RT1064(PFA) when there is SWD 0 Devices detected. And I'm able to recover also.

Only thing, I want to know is If I've edited the driver correctly according to the datasheet of MAX17260. Can you pl help me with this?

0 Kudos
Reply

3,444 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP ,

   Thanks for your updated information.

1. If just SDK project, whether you have this debug issues or not? Or just your modified project?

  If just your own project meet this issues, which details point you have modified based on the SDK?

2. Your SDK2.7.0 is old, you need to download the newest SDK from this link:

https://mcuxpresso.nxp.com/

SDK2.10.0 is coming, the published one is SDK2.9.1, newer than yours.

3. Your MCUXpresso IDE also very old, please download the new IDE:

www.nxp.com/mcuxpresso

4.  I've edited the driver correctly according to the datasheet of MAX17260

As you know, MAX17260 is not the NXP product, so I think you need to check the MAX17260 datasheet, and check the working wave, then compare with the RT sendout wave on the I2C bus, whether slave ACK or not, please check the I2C bus wave to check details.

 

Best Regards,

kerry

0 Kudos
Reply

3,433 Views
PriyaMP
Contributor I

Hi Kerry,

Thanks for the response.

I've installed MCUXPRESSO 11.3 and SDK 2.9.1

The driver seems to work when DTC is selected as memory.

But it doesn't seem to work when Flash is selected as memory.

Other SDK drivers seems to work when flash is selected as memory.

Kindly guide.

0 Kudos
Reply

3,430 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP 

 Customer board not the NXP RT1050-EVKB board, right?

  What's the external memory you are using? QSPI flash?

 As you know, the NXP MIMXRT1050-EVKB is using the on board hyperflash.

So, if your customer board is the QSPI flash, you need to change these things:

1. XIP the evkmimxrt1060_flexspi_nor_config.c

You need to use the RT1060 related code, as the RT1060 is using the QSPI flash.

2. Which debugger you are using? As different debugger, situation is not the same, to RT1050, it is using the hyperflash, we need to change the download flashloader as the qspi flash.

Take cmsis dap as an example, then you need to change the .cfx

kerryzhou_0-1624432143651.png

 

Best Regards,

kerry

0 Kudos
Reply

3,425 Views
PriyaMP
Contributor I

Hi Kerry,

Thanks for the response

Yes its my custom board with i.mxrt1050 and flash - IS25LP064.

1. XIP the evkmimxrt1060_flexspi_nor_config.c

Yes I'm aware about the changes in xip and I've added for QSPI only

2. Which debugger you are using?

I'm using LPC-LINK2 Debugger and I had selected MIMXRT1050_SFDP_QSPI as flash driver.

The SDK driver seems to work with SRAM_DTC but results in SWD 0 devices detected when flash is selected as primary memory.

Kindly guide.

Thank you.

0 Kudos
Reply

3,417 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP 

  Your IS25LP064 is the new chip which didn't write the code previously?

   Please test this code at first:

SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\flexspi\nor\polling_transfer

 Run it in the internal RAM, then check, whether your external flash can do the erase, program, read successfully, this code will also enable the QE bit to the new chip.

 Please test it at first.

Any updated information, just kindly let me know.

kerry

0 Kudos
Reply

3,414 Views
PriyaMP
Contributor I

Thanks for the response Kerry.

Your IS25LP064 is the new chip which didn't write the code previously?

No, The flash - IS25LP064 works fine for all the other SDK projects, except of this one.

Testing with SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\flexspi\nor\polling_transfer

Yes, I had first tested the flash with this SDK. It seems to work fine.

Only for this SDK example it doesn't seem to work with Flash

Kindly guide.

 

0 Kudos
Reply

3,407 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP 

1. Please run SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\flexspi\nor\polling_transfer

And share me your test result, please note, this project run from the RAM.

kerryzhou_0-1624586675651.png

Then send me your printf result. I need to make sure your external QSPI really works OK, and you also enable the QE bit, this is important.

But you mentioned other SDK works, it should has no problem, so just one confirm point to your result.

2. About your attached code

I have one MIMXRT1050-EVKB board which I have modified it to the QSPI flash, then I run your attached project directly , this is my debug result:

kerryzhou_1-1624587058605.png

you can find, I can enter the debug mode the first time, without your mentioned SWD issues.

Then run it, your code meet fault issues, then the SWD can't be connected.

kerryzhou_3-1624587798332.png

 

So, mainly your modified code issues,  I think you can do the external memory erase at first, then run the SDK code for this project without modification again, it should works.

From now, your SWD issues are mainly caused by your modified project.

This situation, let's recover your SWD interface at first.

import one SDK evkbimxrt1050_lpi2c_interrupt_b2b_transfer_master_SDK project, then your board enter serial download mode, use the new SDK download, please note, modify the related point to the QSPI interface. you can download, but can't enter the debug mode, it doesn't matter, after code is downloaded, exit the debug mode, then board enter the internal boot mode again, reset the board or repower on it. then download the SDK project again, you will find your SWD is back.

Your main issue is caused by your own modified code, this is the SDK debug result:

kerryzhou_2-1624587574046.png

You can modified the code again based on the SDK project. 

I don't know which detail modified points on the SDK.

I suggest you test the SDK project again without modification, after it works, then you can add your modification step by step.

pinmux refer to the SDK code, add both IOMUXC_SetPinMux and IOMUXC_SetPinConfig for the I2C.

BTW, please also use the new SDK version.

Please follow my advice and try it again.

Any updated information, kindly let me know.

 

Best Regards,

kerry

 

 

 

 

0 Kudos
Reply

3,411 Views
PriyaMP
Contributor I

Thanks for the response Kerry.

1. Please run SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\flexspi\nor\polling_transfer

screenshot.JPG

2. import one SDK evkbimxrt1050_lpi2c_interrupt_b2b_transfer_master_SDK project

I've followed all your steps.

I've imported new SDK example  and just changed the slave address and pin muxing, with no modification

It resulted in the same error SWD 0 devices detected.

I think the issue is with the slave.

Will try to debug and get back to you.

Thank you

0 Kudos
Reply

3,408 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @PriyaMP 

If import the project totally without the modification, has issues or not?

 Please note, you already has the SWD issues, you need to recover it at first, do you follow my steps to recover it with the SDK project no modifications.

1. enter serial download mode

2. Download the SDK project which no modification, enter debug mode, ignore the issues, then exit it.

3. change the mode back to internal boot mode

4. download the SDK i2c master project again, do you can enter the debug mode or not? 

I mean, just SDK project, no modifications.

After it works, then you can try to modify the project again step by step.

Best Regards,

kerry

0 Kudos
Reply

3,398 Views
PriyaMP
Contributor I

Thanks for the response Kerry.

If import the project totally without the modification, has issues or not?

The imported project also results in SWD 0 devices detected.

Yes, I'm aware about the steps to recover.

Kindly note with Flash chosen as the primary memory , debug never enters the main, and it results in SWD 0 Devices for the second time of the debug.

But when SRAM_DTC is chosen as primary memory, it enters the main function.

The debug enters the main function but it doesn't write to the slave.

I feel slave address is itself wrong.

Its not the one given in the datasheet. In the datasheet they've given 0x6C as the salve address.. I tried with changing the slave address with 0x6C and 0x36.. It doesn't seem to work.

I feel the slave is not responding.

Can you pl suggest a way to debug?

0 Kudos
Reply

3,389 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi  @PriyaMP 

  If your directly SDK project still have the SWD connect issues with the flash method, you still need to erase all the external QSPI flash, do you try my method? enter serial download mode, download SDK code, back to the boot internal mode, whether that works or not?

  Now, in fact, you meet two issues: flash SWD connect issues, and I2C slave address issues.

1. flash SWD connect issues

   Use the SDK code download in serial download mode to recover it, please tell me whether it works on your side or not, it should work, as I always do it like that.

 

2. About the I2C slave address

  Please note, the I2C slave address is 7 bit address.

 0x6C =01101100

0x36 = 00110110

   So, you need to check the I2C bus, the slave address is more clear, it normally will be: 7bit address+W/R+ACK

Please check the I2C bus.

Best Regards,

kerry

 

0 Kudos
Reply