MikroElektronika micromedia plus mx7

Asked by Anthony at 00:43 on 26 Jul 2017.

Hello Matt, Have you had a chance to look at the micromedia plus mx7 board files?

https://shop.mikroe.com/mikromedia-4-pic32mx7

The current uecide board files have the pic32mx460 and the plus has the pic32mx795f512l, would you consider supporting the plus mx7 board. Thank you

Regards Anthony

Sign up or log in for live updates and to post messages.

If the pinout is the same it should just be a case of adjusting the processor in the board.txt file.

Posted 27 Jul 2017, 09:35, 0 votes
matt
Rating: 3

What bootloader comes on that board? I mean, is it STK500v2, UHB, AN1388, what?

Edited 27 Jul 2017, 09:50, 0 votes
matt
Rating: 3

I have assumed UHB like most of their boards seem to use. Here is a board file to test. No guarantees it will work though. It's based on a combination of the existing mikromedia (board defs) and the clicker2 (bootloader config).

Caution

I have had the UHB bootloader commit suicide on many occasions. It's not the most robust of bootloaders around. Be prepared to reinstall the bootloader using the download from the product page and a hardware programmer (pickit3, chipKIT PGM, etc) when testing.

Posted 27 Jul 2017, 10:12, 0 votes
matt
Rating: 3

Hello Matt, Thank you I will give it a try and let you know..... As a thought would a chipkit bootloader work and be more reliable/robust....I have a pickit3 and a mikroe programmer.... Thank you for your help

Posted 28 Jul 2017, 12:19, 0 votes
Anthony
Rating: 0

Yes, it is more robust, but I don't like having to have general users replace their bootloader if possible - many don't have a programmer. So if we can get it working with the existing bootloader it'd be best.

Posted 28 Jul 2017, 14:43, 0 votes
matt
Rating: 3

Hello Matt, The bootloader seems to be UHB HID, I have attached the version that came with the board. Does this tell you anything? I think the chip *.ld file you attached may be the wrong one, the mikromedia board has a mx chip....the file attached is pic32mz795f512l-uhb.ld. Is this a typo? Also a small typo in the board.txt, "ldscript=pic32...2...mx795f512l-uhb.ld" I have a demo sketch that compiles...although I will wait for your comments before trying to program the board

I have also attached the board defs.h file, I have tried to list the various pins... and the schematic for the board Thank you very much for you help Regards Anthony

Edited 31 Jul 2017, 04:43, 0 votes
Anthony
Rating: 0

board_Defs.h

Posted 31 Jul 2017, 04:45, 0 votes
Anthony
Rating: 0

Yes, that is most definitely a typo. There is no mz795 ;)

Posted 31 Jul 2017, 10:12, 0 votes
matt
Rating: 3

Here's a new version of the board package with the fixed linker script names. I haven't touched the board_defs - they are still the same as the 460 version. Let's get it blinking an LED first ;)

Posted 31 Jul 2017, 10:16, 0 votes
matt
Rating: 3

Hello Matt, The mx7 board doesnt show up as a com port although it has the driver installed and is connected... I have tried uploading the hex file from uecide using the mikroe bootloader utility however it came up with a warning that the hex would overwrite part of the bootloader....I did not continue I have attached a screen shot of my pc The Picadillo35T has the pic32795mx would the board defs be similar?

Regards Anthony

Posted 04 Aug 2017, 01:11, 0 votes
Anthony
Rating: 0

The MX7 won't show as a COM port unless you program it to emulate a COM port. The bootloader is HID based, not COM port based. You have to reset the board at the right time in order to enter the bootloader.

No, the Picadillo's board defs will be very very different. The problem here is the linker script - that defines where things get put in memory. In similar existing boards special code has to be manually placed in certain areas to make it boot, and the bootloader spreads itself around inside the main program flash instead of using the boot memory properly. It's a really nasty bootloader and I have never liked working with it.

Posted 04 Aug 2017, 10:16, 0 votes
matt
Rating: 3

Hello Matt, I read that I need to press reset and the Bootloader will be available for 5 seconds, however it seems to be a shorter time for me... I did this in uecide but perhaps not at the right time... What do you think is the next step?

Regards Anthony

Posted 04 Aug 2017, 11:33, 0 votes
Anthony
Rating: 0

UECIDE should be displaying a message in the console window saying to reset the board:

Programmer for Microchip PIC32 microcontrollers, Version 2.1.0
    Copyright: (C) 2011-2015 Serge Vakulenko

*** Enter programming mode now. ***

It is at that point you should press the reset button and it should immediately start programming. However there is the risk that it will kill the bootloader at the moment.

Posted 04 Aug 2017, 12:31, 0 votes
matt
Rating: 3

Ah, it may be the special jump code that the MikroE flasher program is complaining about. The flasher program probably puts that code in for you, whereas we put it in via the linker script. The two would conflict - so you can't really use the MikroE flasher with code generated by chipKIT.

SECTIONS
{
  .jump : {
    LONG(0x3C1F9D00)    /* lui ra 0x9d00 */
    LONG(0x37ff1000)    /* ori ra 0x1000 */
    LONG(0x03e00008)    /* jr ra */
    LONG(0x00000000)    /* nop */
  } > jump_mem
}

It really is the nastiest way of dealing with a bootloader.

Posted 04 Aug 2017, 12:35, 0 votes
matt
Rating: 3

Hello Matt, Yes uecide did give the comment "Enter programming mode...." however when I pressed the reset button on the mx7 board uecide reported "uhb not found...." I will try again...and let you know the outcome

The mikroE Bootloader did connect to the board quickly...

Perhaps I should consider using the chipkit Bootloader

Regards Anthony

Posted 05 Aug 2017, 05:24, 0 votes
Anthony
Rating: 0

It could be that I am looking for the wrong USB VID/PID pair. I'd need to know what the VID/PID is when the bootloader runs, if that's possible for you to get.

Posted 05 Aug 2017, 10:17, 0 votes
matt
Rating: 3

Actually, it helps if I look at least for some USB device... I didn't have a VID/PID in there at all...!

Posted 05 Aug 2017, 10:40, 0 votes
matt
Rating: 3

Ok, I have put in the VID/PID from the Clicker2 - I don't know if it's right or not, but worth a try. The one I have is 1234/0001 though yours may be different - you'd need to do some looking in your OS of choice to find it.

Posted 05 Aug 2017, 10:42, 0 votes
matt
Rating: 3

Hello Matt, Thank you yes the 1234/0001 is right... Success of a sort, you can see from the attached doc, I programmed the board with a demo serial print sketch. Works well.. I did also code it to blink a led but no blinking yet, may be in the board defs.... You may see in the board def file I attached earlier there is a RGB led on pins 76,77,78

I have put in the board def file:

define PIN_LED_RED 76 //RD1

define PIN_LED_GREEN 77 //RD2

define PIN_LED_BLUE 78 //RD3 and re-programmed the board but no blinking yet

Regards Anthony

Posted 06 Aug 2017, 09:23, 0 votes
Anthony
Rating: 0

Hello Matt, Success blinking, I looked up the board data to find the RGB led pins equiv and the red in on RD1 which is pin 49 at the moment...so yes blinking red! Regards Anthony

Posted 06 Aug 2017, 09:54, 0 votes
Anthony
Rating: 0

Excellent. So we just need to sort out the pin definitions. I could do with getting the schematic for that board and checking through the files to get all the right pins in the right places. It sounds like there are differences between this version and the old one - or the old one was also wrong.

Posted 06 Aug 2017, 10:55, 0 votes
matt
Rating: 3

Hello Matt, I think I attached the board schematic in an earlier post.. I had a go at trying to connect to the SD but no luck yet, the chip select is on RA6 but the sd seems to not be on spi2... I will keep looking into it... Programming the board seems stable, I have all the RGB leds blinking... Also the tft is an SD1963 driver, you have this driver in DisplayCore so I hope it should be straight forward to get going Thank you for your help Regards Anthony

Posted 06 Aug 2017, 12:28, 0 votes
Anthony
Rating: 0

Hello Matt, The SD seems to be on SPI1, i am not sure how to put this in the Board Defs... I have attached the Board_Def I have started on.. Regards Anthony

Posted 06 Aug 2017, 13:44, 0 votes
Anthony
Rating: 0

It's these two blocks:

#define _SPI_BASE       _SPI2_BASE_ADDRESS
#define _SPI_ERR_IRQ    _SPI2_ERR_IRQ
#define _SPI_RX_IRQ     _SPI2_RX_IRQ
#define _SPI_TX_IRQ     _SPI2_TX_IRQ
#define _SPI_VECTOR     _SPI_2_VECTOR
#define _SPI_IPL_ISR    _SPI2_IPL_ISR
#define _SPI_IPL        _SPI2_IPL_IPC
#define _SPI_SPL        _SPI2_SPL_IPC

/* The Digilent DSPI library uses the same port.
*/
#define _DSPI0_BASE         _SPI2_BASE_ADDRESS
#define _DSPI0_ERR_IRQ      _SPI2_ERR_IRQ
#define _DSPI0_RX_IRQ       _SPI2_RX_IRQ
#define _DSPI0_TX_IRQ       _SPI2_TX_IRQ
#define _DSPI0_VECTOR       _SPI_2_VECTOR
#define _DSPI0_IPL_ISR      _SPI2_IPL_ISR
#define _DSPI0_IPL          _SPI2_IPL_IPC
#define _DSPI0_SPL          _SPI2_SPL_IPC

Change them to SPI1:

#define _SPI_BASE       _SPI1_BASE_ADDRESS
#define _SPI_ERR_IRQ    _SPI1_ERR_IRQ
#define _SPI_RX_IRQ     _SPI1_RX_IRQ
#define _SPI_TX_IRQ     _SPI1_TX_IRQ
#define _SPI_VECTOR     _SPI_1_VECTOR
#define _SPI_IPL_ISR    _SPI1_IPL_ISR
#define _SPI_IPL        _SPI1_IPL_IPC
#define _SPI_SPL        _SPI1_SPL_IPC

/* The Digilent DSPI library uses the same port.
*/
#define _DSPI0_BASE         _SPI1_BASE_ADDRESS
#define _DSPI0_ERR_IRQ      _SPI1_ERR_IRQ
#define _DSPI0_RX_IRQ       _SPI1_RX_IRQ
#define _DSPI0_TX_IRQ       _SPI1_TX_IRQ
#define _DSPI0_VECTOR       _SPI_1_VECTOR
#define _DSPI0_IPL_ISR      _SPI1_IPL_ISR
#define _DSPI0_IPL          _SPI1_IPL_IPC
#define _DSPI0_SPL          _SPI1_SPL_IPC
Posted 06 Aug 2017, 13:59, 0 votes
matt
Rating: 3

Hello Matt, Thank you i changed the Board Def to match your post... No success with the SD yet, I read from the schematic: -------------------------------------------------------------/ // #define SD-CS 91 //RA6 or 6 // #define SD_SPI_MOSI 72 //RD0 SDO1 SPI1 from the pic mx7 data sheet // #define SD_SPI_MISO 9 //RC4 SDI1 SPI1
// #define SD_SCK 70 //RD10 SCK1 SPI1 // #define SD_CD 92 //RA7

I am using 6 as the CS in my sketch from Board_Data RA6.... Regards Anthony

Posted 07 Aug 2017, 02:34, 0 votes
Anthony
Rating: 0

After changing the Board_Defs.h file you may well need to purge the cache files in order to get the changes picked up. Hold SHIFT while pressing the compile button.

Posted 07 Aug 2017, 10:47, 0 votes
matt
Rating: 3

Hello Matt,

Done, thank you and success reading the SD card....

Posted 07 Aug 2017, 12:23, 0 votes
Anthony
Rating: 0

Hello Matt, Now to work on the tft.. Would you mind giving me a rundown on the structure of the Board Defs, how does the pin numbering work? The mx board has some pins drawn out to the edges that mikroE calls HDR1 and 2, is it possible to define these? Thank you for your help, it is going well.... Regards Anthony

Posted 08 Aug 2017, 10:41, 0 votes
Anthony
Rating: 0

Hello Matt, I have the tft screen backlight on but no text yet... I am using the SSD1963.. from the schematic SSD1963 tft(rs B15, wr D4, rd D5, cs F12, rst C1, E0, E1, E2, E3, E4, E5, E6, E7, G0, G1, F1, F0, D12, D13, D6, D7,2);

SSD1963 tft(31, 52, 53, 92, 33, 64, 65, 66, 67, 68, 69, 70, 71, 96, 97, 81, 80, 60, 61, 54, 55,2);

I am using the current Board Defs to get the pin numbers

Thank you for any suggestions..

Regards Anthony

Edited 08 Aug 2017, 13:07, 0 votes
Anthony
Rating: 0

Posted 08 Aug 2017, 13:03, 0 votes
matt
Rating: 3

Thank you I will study the pdf closely...

Posted 08 Aug 2017, 13:09, 0 votes
Anthony
Rating: 0

Hello Matt, I have some success with the tft I had to change the values in ssd1963... static const uint16_t HDP=479;//799; static const uint16_t HT=531;//928; static const uint16_t HPS=43;//46; static const uint16_t LPS=8;//15; static const uint8_t HPW=10;//48;

    static const uint16_t   VDP=271;//479;
    static const uint16_t   VT=288;//525;
    static const uint16_t   VPS=12;//16;
    static const uint16_t   FPS=4;//8;
    static const uint8_t    VPW=10;//16;

I have attached a picture...the text colours are a bit out but workable... Now on to the touch panel..... Regards Anthony

Posted 09 Aug 2017, 10:39, 0 votes
Anthony
Rating: 0

For the TFT it should be done as a new profile. I am feeding those values into a new MIKROMEIA profile for the driver. When I have tested that it compiles you should be able to activate it with:

tft.initializeDevice(SSD1963::MIKROMEDIA);

I don't know the STMPE610 chip that is used for the touch screen. I don't have a driver for it in DisplayCore. I would have to investigate how it works and write a specific driver for it so that you can use it with DisplayCore.

Posted 09 Aug 2017, 11:25, 0 votes
matt
Rating: 3

OK, I have uploaded a new set of packages for DisplayCore with this SSD1963 change in.

Posted 09 Aug 2017, 11:45, 0 votes
matt
Rating: 3

Hello Matt, Thank you I will give it a try now... I also sorted the colour, it was my fault I didnt have the TFTBUS24 ...

Posted 09 Aug 2017, 12:34, 0 votes
Anthony
Rating: 0

Hello Matt,

tft.initializeDevice(SSD1963::MIKROMEDIA); Works well, thank you

Posted 09 Aug 2017, 12:45, 0 votes
Anthony
Rating: 0

Hello Matt, The touch panel seems to be on i2c2 on RA2 and RA3. I found a library from Adafruit however I have not been able to get it to communicate... I think the issue is in the board defs file I haven't got i2c defined properly I am open to any suggestions

By the way I have a demo sketch that shows of displaycore very well, even displaying an image using drawrgba.... Thank you Regards Anthony

Posted 14 Aug 2017, 11:27, 0 votes
Anthony
Rating: 0

For the Wire.h library you need to make sure that these lines are correct:

#define _TWI_BASE       _I2C1_BASE_ADDRESS
#define _TWI_BUS_IRQ    _I2C1_BUS_IRQ
#define _TWI_SLV_IRQ    _I2C1_SLAVE_IRQ
#define _TWI_MST_IRQ    _I2C1_MASTER_IRQ
#define _TWI_VECTOR     _I2C_1_VECTOR
#define _TWI_IPL_ISR    _I2C1_IPL_ISR
#define _TWI_IPL        _I2C1_IPL_IPC
#define _TWI_SPL        _I2C1_SPL_IPC

For the DTWI.h library, which allows access to multiple channels, you need to configure these:

#define _DTWI0_BASE     _I2C1_BASE_ADDRESS
#define _DTWI0_BUS_IRQ  _I2C1_BUS_IRQ
#define _DTWI0_SLV_IRQ  _I2C1_SLAVE_IRQ
#define _DTWI0_MST_IRQ  _I2C1_MASTER_IRQ
#define _DTWI0_VECTOR   _I2C_1_VECTOR
#define _DTWI0_IPL_ISR  _I2C1_IPL_ISR
#define _DTWI0_IPL      _I2C1_IPL_IPC
#define _DTWI0_SPL      _I2C1_SPL_IPC

#define _DTWI1_BASE     _I2C2_BASE_ADDRESS
#define _DTWI1_BUS_IRQ  _I2C2_BUS_IRQ
#define _DTWI1_SLV_IRQ  _I2C2_SLAVE_IRQ
#define _DTWI1_MST_IRQ  _I2C2_MASTER_IRQ
#define _DTWI1_VECTOR   _I2C_2_VECTOR
#define _DTWI1_IPL_ISR  _I2C2_IPL_ISR
#define _DTWI1_IPL      _I2C2_IPL_IPC
#define _DTWI1_SPL      _I2C2_SPL_IPC

I guess change all the I2C1 and I2C_1 references to I2C2 and I2C_2 and vice versa.

Posted 14 Aug 2017, 12:00, 0 votes
matt
Rating: 3

Oh, and if you can point me to the Adafruit library I may be able to bend it into a DisplayCore library so you can use it with widgets.

Posted 14 Aug 2017, 12:00, 0 votes
matt
Rating: 3

Hello Matt, Thank you Below is a link to the library I tried...

https://github.com/adafruit/Adafruit_STMPE610

Posted 14 Aug 2017, 13:11, 0 votes
Anthony
Rating: 0

Hello Matt, The board has an ADXL345 accel sensor also on the i2c so I will need to use the DTWI library Is it nesesary to set the below...?

define _DTWI0_SCL_PIN 58

define _DTWI0_SDA_PIN 59

I am not sure how to put the pin numbers..on the chip they are RA2 and RA3..in my board def file they are numbers 2 and 3... Thank you

Posted 14 Aug 2017, 13:21, 0 votes
Anthony
Rating: 0

Hello Matt, Using the DTWI scan example gives:

starting master mode on I2C bus -= 0 =- I2C device found at address 0x1D ! I2C device found at address 0x44 ! I2C device found at address 0x78 ! starting master mode on I2C bus -= 1 =- No I2C devices found

starting master mode on I2C bus -= 2 =- No I2C devices found

So this is a good start...

Posted 14 Aug 2017, 13:28, 0 votes
Anthony
Rating: 0

I don't think the DTWI pin definitions actually do anything at all. I think they were intended for use with PPS devices, but the I2C never got added into the PPS matrix, so it's not used.

Posted 14 Aug 2017, 13:31, 0 votes
matt
Rating: 3

Hello Matt, It would be fantastic if you could sort out a touch library, thank you very much.. If you have an example folder for this board I would be happy to put up what I have working Regards Anthony

Posted 14 Aug 2017, 13:48, 0 votes
Anthony
Rating: 0

I just made a repo for the board. If you want to fork it and put your changes in, and any examples in an examples folder, the generate a PR I will get it included.

Posted 14 Aug 2017, 13:53, 0 votes
matt
Rating: 3

Posted 14 Aug 2017, 13:53, 0 votes
matt
Rating: 3

Hello Matt, I have the touch screen working and also scaled the touch point to the screen size... I used the Adafruit library just the screen address is 0x44.. I will now work on the other devices, accel mp3, click shield etc and when I have these working I will put demo sketches in the examples folder Regards Anthony

Posted 18 Aug 2017, 12:36, 0 votes
Anthony
Rating: 0

Hello Matt,

I have added an examples folder with a few examples and sent a pull request..... I hope to add a few more examples as I go

Regards Anthony

Posted 06 Sep 2017, 09:29, 0 votes
Anthony
Rating: 0

I saw - merged it already :)

Posted 06 Sep 2017, 09:29, 0 votes
matt
Rating: 3

examples in a zip should anyone want to have a look...

Posted 06 Sep 2017, 09:31, 0 votes
Anthony
Rating: 0

This site uses cookies to maintain your current login session and improve your browsing experience. By continuing to use this site you agree to the placing of these cookies on your computer or device.

About cookies | Close this popup