rockxito32 Posted February 19, 2018 Share Posted February 19, 2018 Hi everyone, In this opportunity I want to establish a SPI communication between two PmodACL and a Zedboard, in Vivado software I done it this way: And I got the Bitstream file without any mistake. But how can I do the SDK configuration for read two PmodACL at the same time? Link to comment Share on other sites More sharing options...
jpeyron Posted February 19, 2018 Share Posted February 19, 2018 Hi @rockxito32, The process is very similar to this forum thread. You will need to instantiate multiple structs. Something like: PmodACL acl; PmodACL acl1; In the DemoInitialize() function you will need to call the functions twice. So for example ACL_begin twice one for acl and one for acl1 Spoiler ACL_begin(&acl, XPAR_PMODACL_0_AXI_LITE_GPIO_BASEADDR, XPAR_PMODACL_0_AXI_LITE_SPI_BASEADDR); ACL_begin(&acl1, XPAR_PMODACL_1_AXI_LITE_GPIO_BASEADDR, XPAR_PMODACL_1_AXI_LITE_SPI_BASEADDR); ACL_SetMeasure(&acl, 0); ACL_SetMeasure(&acl1, 0); ACL_SetGRange(&acl, ACL_PAR_GRANGE_PM4G); ACL_SetGRange(&acl1, ACL_PAR_GRANGE_PM4G); ACL_SetMeasure(&acl, 1); ACL_SetMeasure(&acl1, 1); ACL_CalibrateOneAxisGravitational(&acl, ACL_PAR_AXIS_ZP); ACL_CalibrateOneAxisGravitational(&acl1, ACL_PAR_AXIS_ZP); then in your while loop you will call ACL_ReadAccelG and the printf function twice. ACL_ReadAccelG(&acl, &x, &y, &z); printf("X=%f\tY=%f\tZ=%f\n\r", x, y, z); usleep(100000); ACL_ReadAccelG(&acl1, &x, &y, &z); printf("X=%f\tY=%f\tZ=%f\n\r", x, y, z); usleep(100000); thank you, Jon Link to comment Share on other sites More sharing options...
rockxito32 Posted February 20, 2018 Author Share Posted February 20, 2018 Thank you for your soon response Then, it'll be something like that: #include "xparameters.h" #include "xil_cache.h" #include "PmodACL.h" #include <stdio.h> #ifdef __MICROBLAZE__ #include "microblaze_sleep.h" #else #include <sleep.h> #endif void DemoInitialize(); void DemoRun(); void DemoCleanup(); void DemoSleep(u32 millis); void EnableCaches(); void DisableCaches(); PmodACL acl; PmodACL acl1; int main(void) { DemoInitialize(); DemoRun(); DemoCleanup(); return 0; } void DemoInitialize() { EnableCaches(); ACL_begin(&acl, XPAR_PMODACL_0_AXI_LITE_GPIO_BASEADDR,XPAR_PMODACL_0_AXI_LITE_SPI_BASEADDR); ACL_begin(&acl1, XPAR_PMODACL_1_AXI_LITE_GPIO_BASEADDR,XPAR_PMODACL_1_AXI_LITE_SPI_BASEADDR); ACL_SetMeasure(&acl, 0); ACL_SetMeasure(&acl1, 0); ACL_SetGRange(&acl, ACL_PAR_GRANGE_PM4G); ACL_SetGRange(&acl1, ACL_PAR_GRANGE_PM4G); ACL_SetMeasure(&acl, 1); ACL_SetMeasure(&acl1, 1); ACL_CalibrateOneAxisGravitational(&acl, ACL_PAR_AXIS_ZP); ACL_CalibrateOneAxisGravitational(&acl1, ACL_PAR_AXIS_ZP); DemoSleep(1000); // After calibration, some delay is required for the new settings to take effect. } void DemoRun() { float x, y, z; while (1) { ACL_ReadAccelG(&acl, &x, &y, &z); printf("PmodACL 0"); printf("X=%f\tY=%f\tZ=%f\n\r", x, y, z); DemoSleep(1000); ACL_ReadAccelG(&acl1, &x, &y, &z); printf("PmodACL 1"); printf("X=%f\tY=%f\tZ=%f\n\r", x, y, z); DemoSleep(1000); } } void DemoCleanup() { DisableCaches(); } void DemoSleep(u32 millis) { #ifdef __MICROBLAZE__ MB_Sleep(millis); #else usleep(1000 * millis); #endif } void EnableCaches() { #ifdef __MICROBLAZE__ #ifdef XPAR_MICROBLAZE_USE_ICACHE Xil_ICacheEnable(); #endif #ifdef XPAR_MICROBLAZE_USE_DCACHE Xil_DCacheEnable(); #endif #endif } void DisableCaches() { #ifdef __MICROBLAZE__ #ifdef XPAR_MICROBLAZE_USE_DCACHE Xil_DCacheDisable(); #endif #ifdef XPAR_MICROBLAZE_USE_ICACHE Xil_ICacheDisable(); #endif #endif } Link to comment Share on other sites More sharing options...
jpeyron Posted February 20, 2018 Share Posted February 20, 2018 Hi @rockxito32, The sdk code looks right. We have not tested this functionality. As far as I can see there should not be any conflicts with using the ACL IP core more than once in a design. thank you, Jon Link to comment Share on other sites More sharing options...
Question
rockxito32
Hi everyone, In this opportunity I want to establish a SPI communication between two PmodACL and a Zedboard, in Vivado software I done it this way:
And I got the Bitstream file without any mistake. But how can I do the SDK configuration for read two PmodACL at the same time?
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.