mwpost
Members-
Posts
30 -
Joined
-
Last visited
Recent Profile Visitors
829 profile views
mwpost's Achievements
MIDIbox Newbie (1/4)
0
Reputation
-
Vive la France, Pilo! Many thousand "Thanks" for this so far. :thumbsup: It seems to - for whatever reason - both :excl: of my PGA2311s are defect. The code doesn't work with none of them. And if this works for you, a hardware issue is my last guess. I'll order new ICs and will try your code again with these. I'll let you know as soon as I have received them. The ICs are very expensive in Germany so I'll order them in the States. But this will take approx 2 weeks best case unless customs clearance will be quick. Kind regards to St. Etienne! mwpost
-
Hi Thorsten, I think I have tested that already but I will double check that to be absolutely sure. Unfortunately I will not be able to do that before the weekend. Be patient with me 😉 mwpost
-
<blockquote class='ipsBlockquote'data-author="TK." data-cid="168464" data-time="1421791845"><p> So, with MIOS32_SPI_PRESCALER_32 (slower transfer speed) it doesn't work anymore?<br /> <br /> Please check the resulting behaviour of the chip, not the received value.<br /> <br /> Best Regards, Thorsten.</p></blockquote>
-
Hi Thorsten, hi Pilo, some further observations (Pilo, I intiated the SPI Port in App_Init!): After reboot (power down & power up) I sometimes have immediatly after switchin power on very good transmission, sometimes nothong. That seems to be alredy before the application boots (LCD message from mios32_config.h occurs a few instances later. I power the PGA as follows: VA- from an external PSU, VA+ and VD+ is directly taken from J19. The Core itself is also powered by the external PSU. Is there a remarkable delay between the Power on of Core and PGA and the Power provided indirectly at J19?. Thorsten, the initiation of the TransferMode doesn't seem to be the problem. Only if set to ... MIOS32_SPI_TransferModeInit(2, MIOS32_SPI_MODE_CLK0_PHASE0, MIOS32_SPI_PRESCALER_16); ... I get response as we found out earlier in this topic. With the other settings the returnbyte didn't not change while using the code I had before. Kindly, mwpost
-
Hi Pilo, I did setup a new project in eclipse modified the imported template "skeleton" with your proposal. I deleted the APP_Background and pasted your code snippet. Additionally, I also did modify the app.h and included the declaration of the SetPGAGain routine to avoid warnings from the compiler "implizit use of ...". What should I say? No problems with compiling or flash of the Core. But during startup I don't have the volume muted :wacko: at all, I still hear audio coming through very clearly. When I call the SetPGAGain as described in the command line in MIOS Studio I receive "command handler not implemented by the application". Coming to the hobbies: Well, maybe my posts reminded you of starting a new project you wanted to start a long time ago. I came to MIOS and started to learn basic electronics with the objective to have a midified tube preamplifier for my rock organ with the ability to be remote controlled via MIDI. Now I know designing power supplies, rectifiers and maybe soon I will know how this PGA works with my Midibox :rofl: Kindly mwpost
-
Hi Pilo, Thanks for your confirmation of the code which should be clear now. (Except your little mistake with the PinSet-Function we already discussed ealier (--> it neerds to be MIOS32_SPI_PinSet (2,0,0) and MIOS32_SPI_PinSet (2,0,1) because I have a single PGA2311 connected to RC1 on J19. It is also clear that I need to modify the second byte to change Vol Level for the left channel, which is connected to a mono audio source. What did I do the last 10 years? I would have better spent them on electronics and PIC programming instead of other useless hobbies :hyper: I still think my problems have to do with the STM32F407 discovery. Did you (or Thorsten?) ever try to connect one of the PGA chips to the J19 of a core PCB of a STM32F4?? I mean instead of connecting them to a PIC. If so, you must have had the same problems...? :pirate: So I guess it has something to do with the signal sent by the core through the 74HCT541, no? Again a discription of what I observe: I have over most of the value changes through the encoder no change in the throughput of the PGA. In a sudden the IC seems to understand one Byte transfer and it transmits very loud. This level remains even if I keep on turning the encoder. In a sudden - while I keep on changing values slowly - volume drecreases by different, often very different steps. :poke: The debug messages and the MIDI traffic scanned with MIOS_Studio help me to recognize the change in values. I also get return values as expected after the explanation of Thorsten (not the currenct value is returned but the value that has been replaced by the current value). :shifty: I have another brand new PGA2311 which shows the same beaviour so I would exclude hardware failure of the ICs. Kindly mwpost
-
Hi Thorsten, you are correct with the 7-bit. I already changed this, but thanks for your "heads up". :thumbsup: The rest of your message is frustrating me a little bit. :sad: I've been trying to find solutions in this and other forums like DIYAudio.com, but no solution. I would really appreciate to get a code snippet in C that has been checked to be sure someone has made it run bevore with MIOS32 and the STM32F4. I would not need any extra features by now (just the core and the PGA) and would be more than happy to know where the failure is. After your check of the hardware with the scope I would assume that the problem is more related to the software. The sample in Midibox mixer is not of big help as I have absolute no knowledge in ASM. :excl: So maybe someone else can step in and assist? Kindly, mwpost
-
Unfortunately, did not function. Any other hints? Am I wrong or doesn't the function "MIOS32_SPI_TransferByte" expects a u8 value for the second argument? On the other hand, the PGA2311 is awaiting a transfer of a 2byte (=16bits) value on the other hand. So just calling the function twice may not be the appropriate solution, is it? mwpost
-
Finally! I now get output - Thanks so far!! But maybe you can help further: I now make 2 observations: 1) The PGA2311 is not having increasing/decreasing steps when I turn my encoder, even if the variable "value" increases/decreases 1 by 1... :sick: Instead, I get the PGA2311 obviously hopping between values out of the row, it seems to be a random order. Do I need to bitshift the value to follow the requirement of MSB first for the PGA2311? How could that be implemented in my code above? 2) The PGA2311 is not reacting very reliable to the function MIOS32_SPI_TransferByte. I need to execute the function twice to get a reasonable return value (e.g. 0x7F). :rofl: 3) The readbyte (as a return of the function MIOS32_SPI_TransferByte) is not corresponding correctly to the value that has been set. Furthermore it returns the value that has been set in the last call of the function. Thats confusing me. Any hints? :question: :question: mwpost
-
Hi Thorsten, thanks for your support. At least I now get a response from the PGA that make sense. The read byte from the MIOS_SPI_TransferByte function now equals the settings (for most of the cases). Before I always received 255 as a response to this function nevertheless which byte I sent to the PGA2311. I guess this is a positive sign and the digital section of the IC is working. But I still get no change in the Ouput of the chip. I also try a second PGA2311 to exclude that the chip is defective. So maybe I did wrong wiring. Here is my schematic. Don't get confused by the audio connectors, my software only has Switched Stereo Plugs available ;-) Any idea? Kindly, mwpost
-
Hmm - no success so far. Maybe a post of my complete code helps in finding the error: ///////////////////////////////////////////////////////////////////////////// // Include files ///////////////////////////////////////////////////////////////////////////// #include <mios32.h> #include "app.h" ///////////////////////////////////////////////////////////////////////////// // Local definitions ///////////////////////////////////////////////////////////////////////////// #define NUM_ENCODERS 64 ///////////////////////////////////////////////////////////////////////////// // Local variables ///////////////////////////////////////////////////////////////////////////// u8 Sendbyte; u8 enc_virtual_pos[NUM_ENCODERS]; ///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // initialize pin0 & pin1 of J5A as output with internal Pull-Up MIOS32_BOARD_J5_PinInit(0, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); MIOS32_BOARD_J5_PinInit(1, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); MIOS32_BOARD_J5_PinInit(2, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); MIOS32_BOARD_J5_PinInit(3, MIOS32_BOARD_PIN_MODE_OUTPUT_PP); // initialize rotary encoders of the same type (DETENTED2) int enc=0; //for(enc=0; enc<=NUM_ENCODERS; ++enc) { //u8 pin_sr = enc >> 2; // 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 u8 pin_sr = 1; u8 pin_pos = 0; 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; enc_config.cfg.speed = FAST; enc_config.cfg.speed_par = 3; MIOS32_ENC_ConfigSet(enc, enc_config); // reset virtual positions enc_virtual_pos[enc] = 0; //} MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_IO_Init(2, MIOS32_SPI_PIN_DRIVER_STRONG): %03u\n", MIOS32_SPI_IO_Init(2, MIOS32_SPI_PIN_DRIVER_STRONG)); } ///////////////////////////////////////////////////////////////////////////// // This task is running endless in background ///////////////////////////////////////////////////////////////////////////// void APP_Background(void) { // MIOS32_LCD_Initialize MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); // X, Y MIOS32_LCD_PrintString("PreAmp Volume"); MIOS32_LCD_CursorSet(0, 1); // X, Y MIOS32_LCD_PrintString(" Off 0000"); while (1) { } } ///////////////////////////////////////////////////////////////////////////// // 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) { // 1) LED an, wenn Gain (CC=52) <> 0 auf Midi-Kanal 3 if( midi_package.chn == 2 && midi_package.type == CC && midi_package.cc_number == 52 && midi_package.value != 0) { //Kanalschalter-LED Frontseite einschalten MIOS32_BOARD_J5_PinSet(0, 1); //Relais durchschalten auf Pin1 MIOS32_BOARD_J5_PinSet(1, 1); MIOS32_LCD_CursorSet(1, 1); MIOS32_LCD_PrintString("On "); } // 2) LED aus, wenn Gain (CC=52) = 0 auf Midi-Kanal 3 else if( midi_package.chn == 2 && midi_package.type == CC && midi_package.cc_number == 52 && midi_package.value == 0) { //Kanalschalter-LED Frontseite ausschalten MIOS32_BOARD_J5_PinSet(0, 0); //Relais unterbrechen auf Pin1 MIOS32_BOARD_J5_PinSet(1, 0); MIOS32_LCD_CursorSet(1, 1); MIOS32_LCD_PrintString("Off"); } // forward USB0->UART0 and UART0->USB0 switch ( port ) { case USB0: MIOS32_MIDI_SendPackage(UART0, midi_package); break; case UART0: MIOS32_MIDI_SendPackage(USB0, midi_package); break; } } ///////////////////////////////////////////////////////////////////////////// // 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 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 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) { // 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; if( value < 0 ) value = 0; else if( value > 127 ) value = 127; enc_virtual_pos[encoder] = value; // only send if value has changed if( enc_virtual_pos[encoder] != value ) { // store new value enc_virtual_pos[encoder] = value; // send event } MIOS32_MIDI_SendCC(UART0, Chn3, 53, value); MIOS32_MIDI_SendCC(USB0, Chn3, 53, value); short Sendbyte = value*2; 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)); MIOS32_MIDI_SendDebugMessage("MIOS32_SPI_TransferByte L: %04u: %04u", Sendbyte, MIOS32_SPI_TransferByte(2, Sendbyte)); 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); } ///////////////////////////////////////////////////////////////////////////// // This hook is called when a pot has been moved ///////////////////////////////////////////////////////////////////////////// void APP_AIN_NotifyChange(u32 pin, u32 pin_value) { } These are the global compiler settings: Processor: STM32F407VG Family: STM32F4xx Board: MBHP_CORE_STM32F4 LCD: universal The encoder as well as the update on the LCD with every turn is working quite fine. But the PGA does not seem to transmit any audio... Thanks for patience, mwpost
-
MIOS32_SPI_PIN_DRIVER_STRONG_PP is no available option. See declaration ... ///////////////////////////////////////////////////////////////////////////// //! (Re-)initializes SPI IO Pins //! By default, all output pins are configured with weak open drain drivers for 2 MHz //! \param[in] spi SPI number (0, 1 or 2) //! \param[in] spi_pin_driver configures the driver strength: //! <UL> //! <LI>MIOS32_SPI_PIN_DRIVER_STRONG: configures outputs for up to 50 MHz //! <LI>MIOS32_SPI_PIN_DRIVER_STRONG_OD: configures outputs as open drain //! for up to 50 MHz (allows voltage shifting via pull-resistors) //! <LI>MIOS32_SPI_PIN_DRIVER_WEAK: configures outputs for up to 2 MHz (better EMC) //! <LI>MIOS32_SPI_PIN_DRIVER_WEAK_OD: configures outputs as open drain for //! up to 2 MHz (allows voltage shifting via pull-resistors) //! </UL> //! \return 0 if no error //! \return -1 if disabled SPI port selected //! \return -2 if unsupported SPI port selected //! \return -3 if unsupported pin driver mode ///////////////////////////////////////////////////////////////////////////// So I guess you meant to use MIOS32_SPI_PIN_DRIVER_STRONG in my case (I use STM32F4 dicovery)...
-
Thanks Thorsten for your reply, I am using the STM32F4 and will try the settings above. Maybe you also have the possibility to provide the MBMixer Software in C instead of ASM? Or an alternative code snippet in C? I have no idea about ASM ... :pirate: :question: :question: :nuke: Kindly, mwpost
-
I cannot believe that nobody is able to help? :sad: