pilo

Frequent Writer
  • Content count

    1,087
  • Joined

  • Last visited

Everything posted by pilo

  1. seq-productsheet-two.jpg

    It looks very nice! Can't wait to the see the inside :)
  2. EA LPC1769 Revision

    Yes ;) Actually I noticed it didn't fit after I soldered the pin headers... So I removed the plastic, and bend the pins.
  3. EA LPC1769 Revision

    Hi! It's possible to bend the pin to make them match the MBHP PCB, that's what I did. But I think it's better if you can get a rev B! You can find some pictures of my bending here : http://midibox.org/forums/topic/18552-lpc1769-rev-c-different-layout-than-rev-ab/?page=2#comment-167161
  4. OLRE16, in colors.

    It looks really great! I removed led rings from my design because I though it was almost impossible for me to fit them in 1.1in channel strip and looks good. But it seems you managed to do it?
  5. Hi @tago Yes, you can print text using different font faces and sizes. It's not part of MIOS, but works by using bitmap drawing MIOS functions. It's still a bitmap font system, TTF have to be exported to bitmap, so it takes a little bit of memory for each font faces and size. Also it's not a full featured font system, for example it doesn't support kerning (could be added, but will take even more memory).   If you want I could set up a better example (the one I posted was just a quick test).
  6. Hi everyone! I thought it might be a good idea to be able to print variable width font on GLCD. I wrote a simple example using this (see pictures and code in vfw.tar.gz). I don't think it was done before with MIOS? (I made a quick search). The font bitmap are exported from TTF file using a very quick (and ugly) C program based on Freetype (it might be Linux only... Freetype was an easy option for me, and a good font rasterizer). It takes as input the TTF file and a size, which is then exported as a .c file, which can then be included inside MIOS app (one file per font and size).   font.c   vfw.tar.gz
  7. IMG_0295.JPG

    From the album LC clone

  8. IMG_0294.JPG

    From the album LC clone

  9. IMG_0292.JPG

    From the album LC clone

  10. IMG-0294.JPG

     
  11. IMG-0292.JPG

  12. image

    From the album LC clone

  13. image

    From the album LC clone

  14. image

    From the album LC clone

  15. image

    From the album LC clone

  16. image

    From the album LC clone

  17. image

    From the album LC clone

  18. Image

    From the album LC clone

  19. Hi!   I'm not sure if I understand your problem correctly, but it seems like a general code design problem?   If I understand well, you have things that should happen when there's a Midi notify or a button press? A simple way to handle this is simply putting the code that does something outside the MIOS call back : void doSomething(u32 value) { // put your code here } void APP_MIDI_NotifyPackage(mios32void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){ if(/*condition*/) { doSomething(1); // or doSomething(0) } } #define doSomethingButton 4 /* for example */ void APP_DIN_NotifyToggle(u32 pin, u32 pin_value) { if(pin == doSomethingButton) { doSomething(pin_value); } }   Now for the problem with flag (it's a "common" problem, I still see a lots of code with flags every where, and when you want to modify to do something, it does everything but not what you want it to do!). There are several way to handle this. A good one (but it can be tricky to implement sometimes) is the state pattern. Instead of having flags and then testing flags, you replace those by on or more states. States can be function in C, and then you keep a pointer to the current state function, which will do what it should when the app is in this state. I don't have a good example to show this, but if you want to post your code, I can take time to look at it if you want.
  20. PGA2311 STM32F4 HowTo?

    Thank you ;) When i said it might be a hardware issue, I was thinking about something like wiring issue. I fried my testing psu (for the analog +5/-5v) yesterday while working on this, I might have made a modification to the code that prevent it from working after (I wrote the value to dB code after my PSU made some smoke). Also it would be a shame both your PGA chips are broken. I think before ordering new ones there are other things to check ;) First, I use lpc17 core, I don't think it should make a big difference, but maybe it is. Then how did you wire your power supply? I use the +5v from the core for the digital side of the PGA, and another external PSU for the analog side (I build a new one today, not finished yet). Both ground (analog and digital) are connected. Mute and ZCEN are connected to the +5v from the core. Of course analog and digital +5v ARE NOT connected together. Double check your wiring, there might be an error somewhere. No sound at all when you run the application? (Without turning any encoder)
  21. PGA2311 STM32F4 HowTo?

    Here's my test app, it should work now (unless you have an hardware issue).   /* * MIOS32 TI PGA2310/2311/4311 test app * * ========================================================================== * * Copyright © 2015 pilo () * Licensed for personal non-commercial use only. * All other rights reserved. * * ========================================================================== */ ///////////////////////////////////////////////////////////////////////////// // Include files ///////////////////////////////////////////////////////////////////////////// #include <mios32.h> #include "app.h" // warning, buffer should be at least 9 byte long! void PGAGainTodB(char *buffer, u8 gain) { if(gain == 0) { sprintf(buffer, "mute"); return; } // else int _dB = 315 - (1275 - gain * 5); int dB = fabs(_dB / 10); int mod = fabs(_dB % 10); if(mod == 0) sprintf(buffer, "%ddB", _dB / 10); else sprintf(buffer, "%s%d%s%ddB", _dB < 0 ? "-" : "", // sign dB, mod != 0 ? "." : "", mod != 0 ? mod : ""); } void SetPGAGain(u8 leftGain, u8 rightGain) { MIOS32_SPI_RC_PinSet (2,0,0); MIOS32_SPI_TransferByte(2, rightGain); // right MIOS32_SPI_TransferByte(2, leftGain); // left MIOS32_SPI_TransferByte(2, rightGain); // 3 (for PGA4311) MIOS32_SPI_TransferByte(2, leftGain); // 4 MIOS32_SPI_RC_PinSet (2,0,1); //MIOS32_MIDI_SendDebugMessage("SetPGAGain : %d %d\n", leftGain, rightGain); } u8 volumeEncPos = 192; // 0dB #define NUM_ENCODERS 64 ///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // initialize SPI IO pins and protocol MIOS32_SPI_IO_Init(2, MIOS32_SPI_PIN_DRIVER_WEAK); MIOS32_SPI_TransferModeInit(2, MIOS32_SPI_MODE_CLK0_PHASE0, MIOS32_SPI_PRESCALER_16); // ca. 5 MBit // initialize rotary encoders of the same type (DETENTED2) int enc; for(enc=0; enc<NUM_ENCODERS; ++enc) { u8 pin_sr = (enc >> 2) + 1; // each DIN SR has 4 encoders connected u8 pin_pos = (enc & 0x3) << 1; // Pin position of first ENC channel: either 0, 2, 4 or 6 mios32_enc_config_t enc_config = MIOS32_ENC_ConfigGet(enc); enc_config.cfg.type = DETENTED2; // see mios32_enc.h for available types enc_config.cfg.sr = pin_sr; enc_config.cfg.pos = pin_pos; #if 1 // normal speed, incrementer either 1 or -1 enc_config.cfg.speed = NORMAL; enc_config.cfg.speed_par = 0; #else // higher incrementer values on fast movements enc_config.cfg.speed = FAST; enc_config.cfg.speed_par = 2; #endif MIOS32_ENC_ConfigSet(enc, enc_config); } } ///////////////////////////////////////////////////////////////////////////// // This task is running endless in background ///////////////////////////////////////////////////////////////////////////// void APP_Background(void) { MIOS32_MIDI_SendDebugMessage("Started PGA test app\n"); SetPGAGain(volumeEncPos, volumeEncPos); while(1) { } } ///////////////////////////////////////////////////////////////////////////// // This hook is called each mS from the main task which also handles DIN, ENC // and AIN events. You could add more jobs here, but they shouldn't consume // more than 300 uS to ensure the responsiveness of buttons, encoders, pots. // Alternatively you could create a dedicated task for application specific // jobs as explained in $MIOS32_PATH/apps/tutorials/006_rtos_tasks ///////////////////////////////////////////////////////////////////////////// void APP_Tick(void) { // PWM modulate the status LED (this is a sign of life) u32 timestamp = MIOS32_TIMESTAMP_Get(); MIOS32_BOARD_LED_Set(1, (timestamp % 20) <= ((timestamp / 100) % 10)); } ///////////////////////////////////////////////////////////////////////////// // This hook is called each mS from the MIDI task which checks for incoming // MIDI events. You could add more MIDI related jobs here, but they shouldn't // consume more than 300 uS to ensure the responsiveness of incoming MIDI. ///////////////////////////////////////////////////////////////////////////// void APP_MIDI_Tick(void) { } ///////////////////////////////////////////////////////////////////////////// // This hook is called when a MIDI package has been received ///////////////////////////////////////////////////////////////////////////// void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package) { } ///////////////////////////////////////////////////////////////////////////// // This hook is called before the shift register chain is scanned ///////////////////////////////////////////////////////////////////////////// void APP_SRIO_ServicePrepare(void) { } ///////////////////////////////////////////////////////////////////////////// // This hook is called after the shift register chain has been scanned ///////////////////////////////////////////////////////////////////////////// void APP_SRIO_ServiceFinish(void) { } ///////////////////////////////////////////////////////////////////////////// // This hook is called when a button has been toggled // pin_value is 1 when button released, and 0 when button pressed ///////////////////////////////////////////////////////////////////////////// void APP_DIN_NotifyToggle(u32 pin, u32 pin_value) { } ///////////////////////////////////////////////////////////////////////////// // This hook is called when an encoder has been moved // incrementer is positive when encoder has been turned clockwise, else // it is negative ///////////////////////////////////////////////////////////////////////////// void APP_ENC_NotifyChange(u32 encoder, s32 incrementer) { int value = volumeEncPos + incrementer; // clamp the value if(value < 0) value = 0; if(value > 255) value = 255; // set the gain volumeEncPos = value; SetPGAGain(volumeEncPos, volumeEncPos); // print gain in dB char dbBuffer[9]; PGAGainTodB(dbBuffer, volumeEncPos); MIOS32_MIDI_SendDebugMessage("%s\n", dbBuffer); } ///////////////////////////////////////////////////////////////////////////// // This hook is called when a pot has been moved ///////////////////////////////////////////////////////////////////////////// void APP_AIN_NotifyChange(u32 pin, u32 pin_value) { }
  22. PGA2311 STM32F4 HowTo?

    Hi,   Ok good news, I got it working :smile: I use PGA4311 (SMD IC), and my mute pin, after living 10 years in a junk box was broken (I made an error and connect it to GND instead on +5V on my original PCB, and then use a wire to correct this... but the pin didn't handle it over the years).   So the modification I made is in APP_init: MIOS32_SPI_IO_Init(2, MIOS32_SPI_PIN_DRIVER_WEAK); MIOS32_SPI_TransferModeInit(2, MIOS32_SPI_MODE_CLK0_PHASE0, MIOS32_SPI_PRESCALER_16); // ca. 5 MBit   I don't really understand how this and prescaler work, but with those settings I can set the gain. I'll add encoder support for volume change and post the source code.
  23. PGA2311 STM32F4 HowTo?

    Hi!   Do you setup the SPI intervace in APP_init() ? (I think yes, but it's always good to check everything ;) // initialize SPI IO pins and protocol MIOS32_SPI_IO_Init(2, MIOS32_SPI_PIN_DRIVER_STRONG); MIOS32_SPI_TransferModeInit(2, MIOS32_SPI_MODE_CLK0_PHASE0, MIOS32_SPI_PRESCALER_16); // ca. 5 MBit   I don't understand why it doesn't work (and unfortunately I don't have my old PGA pcb here with me). I think the command is not working because there's no command handling callback ;) (you can setup one, but you have to parse it etc).   I had the idea few month ago to make a preamp with the PGA, but it was a few month ago and I haven't done anything yet... :)
  24. PGA2311 STM32F4 HowTo?

    Hi mwpost!   Unfortunately I didn't had the time this week end to test my old pga pcb with MIOS32 (I have an LPC17 board, not STM32F4, but it shouldn't be a big difference for this).   What you could do, is to try to set the gain without the encoder first (comment or remove the code setting the gain in the encoder callback).   just add this function in your c file : void SetPGAGain(u8 leftGain, u8 rightGain) { MIOS32_SPI_RC_PinSet (2,0,0); MIOS32_SPI_TransferByte(2, mios32_dout_reverse_tab[rightGain]); // right MIOS32_SPI_TransferByte(2, mios32_dout_reverse_tab[leftGain]); // left MIOS32_SPI_RC_PinSet (2,0,1); }   and for example in APP_Background void APP_Background(void) { SetPGAGain(0, 0); while (1) { } }   When you start the application, you should hear no sound at all (0 is the special value for MUTE).   Then try for example SetPGAGain(32, 32); etc and then with other values, and see how it behave. It might help to understand what is going on by just changing the value once.     There's no "useless hobby" :smile:  I was very excited by the PGA at that time, I ordered some, made a quick board, wrote the code for MIOS...  and when it worked, I though "Cool, I need to put it in a very cool project!", and I haven't touch it since... (like so many other "project" I started)
  25. PGA2311 STM32F4 HowTo?

    Hi mwpost!   I wrote PGA driver code for pic18f years ago (looking at the source code, it should make 10 years...), which was later improved by Lyle. I remember having fun writing the display part in asm :smile:   Anyway, I'll try to make it work with MIOS32.  I think you're very close to have it working, actually I don't see any problem with your code (if you does the modification correctly).   According to your schematic only the left part of the PGA is tested, and that's the 2nd byte send to the PGA :   void APP_ENC_NotifyChange(u32 encoder, s32 incrementer) { // toggle Status LED on each AIN value change MIOS32_BOARD_LED_Set(0x0001, ~MIOS32_BOARD_LED_Get()); // increment to virtual position and ensure that the value is in range 0..127 int value = enc_virtual_pos[encoder] + incrementer; // clamp the value if( value < 0 ) value = 0; else if( value > 255 ) value = 255; // store enc_virtual_pos[encoder] = value; MIOS32_MIDI_SendCC(UART0, Chn3, 53, value); MIOS32_MIDI_SendCC(USB0, Chn3, 53, value); u8 Sendbyte = mios32_dout_reverse_tab[value]; // MSB first MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_RC_PinSet to 0: %04u", MIOS32_SPI_RC_PinSet (2,1,0)); MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_TransferByte R %04u: %04u", Sendbyte, MIOS32_SPI_TransferByte(2, Sendbyte)); // right channel gain MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_TransferByte L: %04u: %04u", Sendbyte, MIOS32_SPI_TransferByte(2, Sendbyte)); // left channel gain MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_RC_PinSet to 1: %04u", MIOS32_SPI_RC_PinSet (2,1,1)); MIOS32_LCD_CursorSet(10, 1); MIOS32_LCD_PrintFormattedString("%04u", Sendbyte); }   If you daisy chained PGA (or use PGA4311) you should have as many MIOS32_SPI_TransferByte as channels (so you need 2 for one PGA2311, 4 for 2 chained PGA2311, 4 for one PGA4311, 6 for one PGA4311 and one PGA2311, etc). And I wouldn't expect any value returned by MIOS32_SPI_TransferByte?