Problems reading Data from an FPGA via Flexbus

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

Problems reading Data from an FPGA via Flexbus

1,176 Views
ChristofAbt
Contributor II

Good afternoon community, I try to read dta from an FPGA via the NXP Flexbus. The microcontroller is a MK66FN2M0VMD18. Address and Data are multiplexed on a 16bit bidirectional bus. The configuration is  defined in FB_Device0_config. The definition can be seen in the attached file peripherals.c I included

wait states there but to no avail. The C-Code I want to read the data looks like that.

lsb_ad7779_u16 = *(volatile uint16_t*)(fb_base->CS[0].CSAR +129);

It is a read access to address 0d129 = 0x81.

I can observe the data inside the FPGA with an internal logic analyzer. The Address, data and

control signals are as expected for a flexbus read access. Unfortunately I do not see

the correct data in lsb_ad7779_u16.

ChristofAbt_0-1764163846867.png

The address and data is as expected even at the ports of the FPGA. I have no clue why the variable

does not contain the expected data.

 

Best regards in advance

Christof

0 Kudos
Reply
5 Replies

1,149 Views
Pablo_Ramos
NXP Employee
NXP Employee

Hi @ChristofAbt,

I'm not able to see the peripherals.c file you mentioned.

Could you please share the configuration you are using for the FlexBus?

Best Regards,

Pablo

0 Kudos
Reply

1,126 Views
ChristofAbt
Contributor II

Here is the flexbus configuration

* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/

/* clang-format on */

flexbus_config_t FB_Device0_config = {

.chip = 0,

.chipBaseAddress = 0x60000000UL,

.chipBaseAddressMask = 0x0000U,

.byteEnableMode = false,

.autoAcknowledge = true,

.extendTransferAddress = false,

.byteLaneShift = kFLEXBUS_Shifted,

.portSize = kFLEXBUS_2Bytes,

.writeAddressHold = kFLEXBUS_Hold1Cycle,

.readAddressHold = kFLEXBUS_Hold1Or0Cycles,

.addressSetup = kFLEXBUS_FirstRisingEdge,

.waitStates = 0U,

.secondaryWaitStatesEnable = false,

.secondaryWaitStates = 0U,

.burstWrite = false,

.burstRead = false,

.writeProtect = false,

.group1MultiplexControl = kFLEXBUS_MultiplexGroup1_FB_ALE,

.group2MultiplexControl = kFLEXBUS_MultiplexGroup2_FB_CS4,

.group3MultiplexControl = kFLEXBUS_MultiplexGroup3_FB_CS5,

.group4MultiplexControl = kFLEXBUS_MultiplexGroup4_FB_TBST,

.group5MultiplexControl = kFLEXBUS_MultiplexGroup5_FB_TA

};

0 Kudos
Reply

1,036 Views
Pablo_Ramos
NXP Employee
NXP Employee

Hi @ChristofAbt,

Could you help me with the following questions?

When you mention that lsb_ad7779_u16 does not contain the expected data, what data does the variable currently hold?

How is the configuration of the pins being done?

Best Regards,

Pablo

0 Kudos
Reply

768 Views
ChristofAbt
Contributor II

Hello Pablo,

the register contains random data. I can implement a kind of logic analyzer inside the FPGA and see correct data there. The flexbus pins are configured like that.

ChristofAbt_0-1765191008313.png

Best regards

Christof

0 Kudos
Reply

754 Views
Pablo_Ramos
NXP Employee
NXP Employee

Hi @ChristofAbt,

Thanks for sharing the settings.

When you mention that the register contains random data, does it change with every execution?

Are you able to read the bus using an oscilloscope or a logic analyzer? This would help verify the integrity of the data across the bus.

Best Regards,
Pablo

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2249560%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EProblems%20reading%20Data%20from%20an%20FPGA%20via%20Flexbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2249560%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGood%20afternoon%20community%2C%20I%20try%20to%20read%20dta%20from%20an%20FPGA%20via%20the%20NXP%20Flexbus.%20The%20microcontroller%20is%20a%20MK66FN2M0VMD18.%20Address%20and%20Data%20are%20multiplexed%20on%20a%2016bit%20bidirectional%20bus.%20The%20configuration%20is%26nbsp%3B%20defined%20in%26nbsp%3B%3CSPAN%3EFB_Device0_config.%20The%20definition%20can%20be%20seen%20in%20the%20attached%20file%20peripherals.c%20I%20%3C%2FSPAN%3E%3CSPAN%3Eincluded%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ewait%20states%20there%20but%20to%20no%20avail.%20The%20C-Code%20I%20want%20to%20read%20the%20data%20looks%20like%20that.%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3Elsb_ad7779_u16%20%3D%20*(volatile%20uint16_t*)(fb_base-%26gt%3BCS%5B0%5D.CSAR%20%2B129)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20is%20a%20read%20access%20to%20address%200d129%20%3D%200x81.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20can%20observe%20the%20data%20inside%20the%20FPGA%20with%20an%20internal%20logic%20analyzer.%20The%20Address%2C%20data%20and%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Econtrol%20signals%20are%20as%20expected%20for%20a%20flexbus%20read%20access.%20Unfortunately%20I%20do%20not%20see%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ethe%20correct%20data%20in%20lsb_ad7779_u16.%20%3C%2FSPAN%3E%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ChristofAbt_0-1764163846867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1764163846867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1764163846867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1764163846867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1764163846867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F367415i51B09A246103CFE2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ChristofAbt_0-1764163846867.png%22%20alt%3D%22ChristofAbt_0-1764163846867.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CP%3EThe%20address%20and%20data%20is%20as%20expected%20even%20at%20the%20ports%20of%20the%20FPGA.%20I%20have%20no%20clue%20why%20the%20variable%3C%2FP%3E%3CP%3Edoes%20not%20contain%20the%20expected%20data.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EBest%20regards%20in%20advance%3C%2FP%3E%3CP%3EChristof%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2249682%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problems%20reading%20Data%20from%20an%20FPGA%20via%20Flexbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2249682%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248592%22%20target%3D%22_blank%22%3E%40ChristofAbt%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EI'm%20not%20able%20to%20see%20the%20peripherals.c%20file%20you%20mentioned.%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20share%20the%20configuration%20you%20are%20using%20for%20the%20FlexBus%3F%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EPablo%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2254559%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problems%20reading%20Data%20from%20an%20FPGA%20via%20Flexbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2254559%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248592%22%20target%3D%22_blank%22%3E%40ChristofAbt%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3ECould%20you%20help%20me%20with%20the%20following%20questions%3F%3C%2FP%3E%0A%3CP%3EWhen%20you%20mention%20that%20lsb_ad7779_u16%20does%20not%20contain%20the%20expected%20data%2C%20what%20data%20does%20the%20variable%20currently%20hold%3F%3C%2FP%3E%0A%3CP%3EHow%20is%20the%20configuration%20of%20the%20pins%20being%20done%3F%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EPablo%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2257138%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problems%20reading%20Data%20from%20an%20FPGA%20via%20Flexbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2257138%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Pablo%2C%3C%2FP%3E%3CP%3Ethe%20register%20contains%20random%20data.%20I%20can%20implement%20a%20kind%20of%20logic%20analyzer%20inside%20the%20FPGA%20and%20see%20correct%20data%20there.%20The%20flexbus%20pins%20are%20configured%20like%20that.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ChristofAbt_0-1765191008313.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1765191008313.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ChristofAbt_0-1765191008313.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F368965iE0A60AFFA4225134%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ChristofAbt_0-1765191008313.png%22%20alt%3D%22ChristofAbt_0-1765191008313.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EChristof%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2257435%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Problems%20reading%20Data%20from%20an%20FPGA%20via%20Flexbus%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2257435%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248592%22%20target%3D%22_blank%22%3E%40ChristofAbt%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThanks%20for%20sharing%20the%20settings.%3C%2FP%3E%0A%3CP%3EWhen%20you%20mention%20that%20the%20register%20contains%20random%20data%2C%20does%20it%20change%20with%20every%20execution%3F%3C%2FP%3E%0A%3CP%3EAre%20you%20able%20to%20read%20the%20bus%20using%20an%20oscilloscope%20or%20a%20logic%20analyzer%3F%20This%20would%20help%20verify%20the%20integrity%20of%20the%20data%20across%20the%20bus.%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3CBR%20%2F%3EPablo%3C%2FP%3E%3C%2FLINGO-BODY%3E