*jOi~ Posted August 11, 2007 Report Share Posted August 11, 2007 Hi folks,I've had a little box here working w/ a FT232 USB chip for a while now, and it's about time I delve a little further into the possibilities of using MIDI over USB. I'm planning to write up a driver using either chuck, or a small MaxMSP application, though this is probably still a few months off.My question is something that I have touched upon in previous questions, but never got a full answer. What I am looking for is the point in the bootloader firmware that I can modify to allow baudrates other than MIDI and To-COM. My plan is to alter the To-COM value and for it to become To-USB running at 115.2 kbps.Whilst I've been learning a lot about java (and similar languages) I'm still useless working with assembler, and staring at hex values continues to mystify me. If anyone could point to the register that must be changed, I will experiment with the value and investigate the effects of different baudrates - see if i can cause problems w/ overloading the I/O buffer.Thanks for the help friendsTrentEdit: I believe this is the spot, but I have little clue how to interpret the hex values, and what they should become.. movlw (1 << TXEN) | (1 << BRGH) movwf TXSTA IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_TO_HOST, goto Init_USART_MIDIBaudrateInit_USART_RS232Baudrate movlw 2*0x21-1 ; set baudrate to 38400 baud IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_20MHz, movlw 0x21-1 goto Init_USART_ContInit_USART_MIDIBaudrate movlw 8*0x0a-1 ; set baudrate to 31250 baud IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_20MHz, movlw 4*0x0a-1 ;; goto Init_USART_Cont Quote Link to comment Share on other sites More sharing options...
stryd_one Posted August 11, 2007 Report Share Posted August 11, 2007 You're on the right path, just grab a copy of the datasheet for the PIC, and play follow the code.If you convert the hex values to binary (you can use something like PMACalc if you don't like doing it in your head) and look up the registers in the datasheet, it will all make sense. Quote Link to comment Share on other sites More sharing options...
*jOi~ Posted August 11, 2007 Author Report Share Posted August 11, 2007 thanks for the direction stryd... i get the feeling that i will figure this out, but after the first half hour of staring at that datasheet, im glad there is no deadline hanging over my head to get it finished.the answer is there, i can see it, i just read it, all i need now is to understand it.cheers Quote Link to comment Share on other sites More sharing options...
*jOi~ Posted August 12, 2007 Author Report Share Posted August 12, 2007 success!.. well the beginnings of..after ~6hrs of study i know a huge amount more about the beauty of PICs and how they function, assembler is beginning to make sense, and I discovered the all important meaning of 2*0x21-1....the simple answer = (2 * 33) - 1 = 65how does 65 give a baudrate of 38400? only the PIC datasheet knows the answer..'79' gives 31250'65' gives 38400'21' gives 115200my new line is therefore: 2*0x0b-1i finally used MPLAB (which i installed ca. 12mths ago) and compiled my code. my brand new PIC burner has 2 fresh PICs for me now - one with the standard TO-COM 38400 baud (which I know is working), and a second with TO-USB 115200 with which I will now experiment.Next tasks are not the easiest - trying to decipher the way Max/MSP handles SysEx commands, so I can upload MIOS - the joys of uncharted waters with a lack of available drivers..I'll keep you updatedtrent Quote Link to comment Share on other sites More sharing options...
Therezin Posted August 13, 2007 Report Share Posted August 13, 2007 '25' gives 115200my new line is therefore: 2*0x0b-1Correct me if I'm wrong, but isn't 0x0B == 11? Making 2*0x0B-1 = 21?I'd try it with 0x0D myself... Quote Link to comment Share on other sites More sharing options...
*jOi~ Posted August 14, 2007 Author Report Share Posted August 14, 2007 ergg... apologies but in fact, the magic number is '21', and so 2*0x0b-1 should be right. Thanks for picking me up Therezin..I wish you were right though, and I'd been careless in my decimal > hex conversion, but alas the PIC is programmed correctly and yet I can't get applications to upload correctly.Running MIOS Studio via Max/MSP w/ the serial object (and MIDI Yoke), and whilst I had no troubles uploading MIOS to both PICs, I could only get my app to upload correctly to the chip at 38400. Nevertheless, I have successfully got the 38400 PIC running my led/button matrix program (c/o Wilba) without any serial cable or MIDI port.Sometimes it is easy to forget the small goals when you fall short of the large ones, but I have just proved to myself that it is possible to run a MBHP with only a PIC burner and a cheap/small USB chip. This is still a Max/MSP reliant implementation.Developments soon.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.