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

callback from DSP for reporting analysis parameters #244

Open
catfact opened this issue Feb 2, 2016 · 7 comments
Open

callback from DSP for reporting analysis parameters #244

catfact opened this issue Feb 2, 2016 · 7 comments

Comments

@catfact
Copy link
Collaborator

catfact commented Feb 2, 2016

there is a currently-unused pin between avr32 and bfin just for this purpose. could be used to signal when analysis results are ready.

https://github.com/tehn/aleph/blob/dev/bfin_lib_block/src/gpio.h#L45
https://github.com/tehn/aleph/blob/dev/avr32_lib/conf/aleph_board.h#L143

@electropourlaction
Copy link

is there an example available how to use this to report a register value? would like to take a second look at the DMA registers.

@catfact
Copy link
Collaborator Author

catfact commented Jul 30, 2016

yes, you can use inline ASM to read registers.
example: count cycles by combining CYCLES and CYCLES2 registers into a 32-bit C variable:

volatile long int cycles;
asm volatile ("%0 = CYCLES; %H0 = CYCLES2;" : "=d" (cycles));

@electropourlaction
Copy link

thanks!

trying to read registers defined in defBF532.h, like

volatile long int value;
asm volatile ("%0 = MDMA_D1_CONFIG;" : "=d" (value));

but I get undefined reference errors, am I missing something obvious here?

@electropourlaction
Copy link

electropourlaction commented Aug 27, 2016

had some time to try again, apparently register defines can be used outside the asm code, moving on without assembly. edit, oh and I had to include defBF532.h

@ghost
Copy link

ghost commented Aug 28, 2016

@electropourlaction - so have you made any headway on this feature from avr32 side? Did you spot my 'analyser' module? I could quite easily add some 'trigger' type of dsp code if there's something to hook into. schmidtt triger emitting pulses on leading edge of an envelope follower would be cool for starters...

@electropourlaction
Copy link

I managed to get a value back from the bfin, didn't get to verify that it was correct, having trouble with avr debug output to OS X, sometimes I just get scrambled output. actually I haven't thought about using this creatively! haven't seen the analyser module, need to educate myself on these things, it looks like!

@electropourlaction
Copy link

Had a look at your module, looks cool. I go about it in a similar way but may aim is a little bit different atm as I wrote earlier.

inside a handle_switch on the avr;

    //MDMA DEBUG
    volatile int long epd;

    //  call bfin to refresh eParamDebug value
    ctl_param_change(DUMMY, eParamDebug, DUMMY);

    //  fetch eParamDebug value
    epd = bfin_get_param(eParamDebug);

    //  terminal output
    print_dbg("\r\n bfin debug s32: ");
    print_dbg_ulong(epd);
    print_dbg("\r\n bfin debug hex: ");
    print_dbg_hex(epd);

    //  flash led
    gpio_clr_gpio_pin(LED_MODE_PIN);
    delay_ms(50);
    gpio_set_gpio_pin(LED_MODE_PIN);

and on the bfin, when receiving a eParamDebug parameter change message;

    case eParamDebug:
            gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG;
        break;

there could be a race condition here between updating the value on the bfin and outputing the debug message on the avr, but it looks like the values from debug are consistent.

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

No branches or pull requests

2 participants