hi,
I am not really familiarise with assembler. I have a beagle bone black, i followed several examples that I found in internet regarding how to use pwm with PRU ports and it works properly in my BBB.
As I said I am not familiarise with assembler and PRU. I wonder if anybody could help me on that. I need to use 4 pwm and 4 AI in beagle bone, but I don´t know exactly how to do it. I wonder if you could modificate pwm.c and pwm.p to use these signals and also BB-BONE-PRU-00A0.dts
I will really appreciate it if you can help me on that, because i am not sure if i should copy paste the same code several times or create a bucle to get the mod efficient way.
thank you so much and sorry for the inconveniences
regards
1) BB-BONE-PRU-00A0.dts
/*
* pru dts file BB-BONE-PRU-00A0.dts
*/
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-BONE-PRU";
version = "00A0";
exclusive-use =
"P8.12";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
mygpio: pinmux_mygpio{
pinctrl-single,pins = <
0x30 0x06
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&mygpio>;
status = "okay";
};
};
};
fragment@2{
target = <&pruss>;
__overlay__ {
status = "okay";
};
};
};
2) mytest.c
/******************************************************************************
- Include Files *
******************************************************************************/
// Standard header files
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
//#include <math.h>
// Driver header file
#include “prussdrv.h”
#include <pruss_intc_mapping.h>
#include <math.h>
/******************************************************************************
- Local Macro Declarations *
******************************************************************************/
#define PRU_NUM 0
int main(void){
unsigned int ret;
unsigned int i,value;
tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;
printf(“\nINFO: Starting %s example.\r\n”, “PWM Demo with PRU”);
// Initialize the PRU
prussdrv_init();
// Open PRU Interrupt
ret = prussdrv_open(PRU_EVTOUT_0);
if (ret)
{
printf(“prussdrv_open open failed\n”);
return (ret);
}
// Get the interrupt initialized
prussdrv_pruintc_init(&pruss_intc_initdata);
//Execute example on PRU
printf(“\tINFO: Executing example.\r\n”);
prussdrv_exec_program(PRU_NUM, “./mytest.bin”);
for (i = 0; i < 100000; i++) {
usleep(100);
value=(sin(i*0.01)+1)*120+5;
prussdrv_pru_write_memory(PRUSS0_PRU0_DATARAM, 0x00000040, &value, sizeof(unsigned int));
printf("(%d)\n → ",value);
}
// Wait until PRU0 has finished execution
printf(“\tINFO: Waiting for HALT command.\r\n”);
prussdrv_pru_wait_event(PRU_EVTOUT_0);
printf(“\tINFO: PRU completed transfer.\r\n”);
prussdrv_pru_clear_event(PRU0_ARM_INTERRUPT);
// Disable PRU and close memory mapping
prussdrv_pru_disable(PRU_NUM);
prussdrv_exit();
return(0);
}
3) mytest.p