- Posts: 317
Devo Loader. Now working Fully
- SadSack
- Topic Author
- Offline
Thanks
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
From this :
/****************************************************************************************
* U S B C O M M U N I C A T I O N I N T E R F A C E H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called whenever the USB device should be connected
** to the USB bus.
** \param connect BLT_TRUE to connect and BLT_FALSE to disconnect.
** \return none.
**
****************************************************************************************/
void UsbConnectHook(blt_bool connect)
{
static blt_bool initialized = BLT_FALSE;
/* the connection to the USB bus is typically controlled by software through a digital
* output. the GPIO pin for this must be configured as such.
*/
if (initialized == BLT_FALSE)
{
/* enable clock for PC11 pin peripheral (GPIOC) */
RCC->APB2ENR |= (blt_int32u)(0x00000010);
/* configure DIS (GPIOC11) as open drain digital output */
/* first reset the configuration */
GPIOC->CRH &= ~(blt_int32u)((blt_int32u)0xf << 12);
/* CNF11[1:0] = %01 and MODE11[1:0] = %11 */
GPIOC->CRH |= (blt_int32u)((blt_int32u)0x7 << 12);
/* set to initialized as this part only has to be done once after reset */
initialized = BLT_TRUE;
}
/* determine if the USB should be connected or disconnected */
if (connect == BLT_TRUE)
{
/* the GPIO has a pull-up so to connect to the USB bus the pin needs to go low */
GPIOC->BRR = (blt_int32u)((blt_int32u)0x1 << 11);
}
else
{
/* the GPIO has a pull-up so to disconnect to the USB bus the pin needs to go high */
GPIOC->BSRR = (blt_int32u)((blt_int32u)0x1 << 11);
}
} /*** end of UsbConnect ***/
to this :
/****************************************************************************************
* U S B C O M M U N I C A T I O N I N T E R F A C E H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called whenever the USB device should be connected
** to the USB bus.
** \param connect BLT_TRUE to connect and BLT_FALSE to disconnect.
** \return none.
**
****************************************************************************************/
void UsbConnectHook(blt_bool connect)
{
static blt_bool initialized = BLT_FALSE;
/* the connection to the USB bus is typically controlled by software through a digital
* output. the GPIO pin for this must be configured as such.
*/
if (initialized == BLT_FALSE)
{
/* enable clock for PC10 pin peripheral (GPIOB) */
RCC->APB2ENR |= (blt_int32u)(0x00000008);
/* configure DIS (GPIOB10) as open drain digital output */
/* first reset the configuration */
GPIOB->CRH &= ~(blt_int32u)((blt_int32u)0xf << 8);
/* CNF11[1:0] = %01 and MODE11[1:0] = %11 */
GPIOB->CRH |= (blt_int32u)((blt_int32u)0x7 << 8);
/* set to initialized as this part only has to be done once after reset */
initialized = BLT_TRUE;
}
/* determine if the USB should be connected or disconnected */
if (connect == BLT_TRUE)
{
/* the GPIO has a pull-up so to connect to the USB bus the pin needs to go low */
GPIOB->BRR = (blt_int32u)((blt_int32u)0x1 << 10);
}
else
{
/* the GPIO has a pull-up so to disconnect to the USB bus the pin needs to go high */
GPIOB->BSRR = (blt_int32u)((blt_int32u)0x1 << 10);
}
} /*** end of UsbConnect ***/
Ok for now
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
This should be easy (yeah right)moving B0 to C9 so it can be used for Backdoor Entry into loader.
Now C9 is using button matrix Row C9 / Column B9 = Ext
/****************************************************************************************
* B A C K D O O R E N T R Y H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_BACKDOOR_HOOKS_ENABLE > 0)
/************************************************************************************//**
** \brief Initializes the backdoor entry option.
** \return none.
**
****************************************************************************************/
void BackDoorInitHook(void)
{
/* enable clock for PA0 pin peripheral (GPIOA) */
RCC->APB2ENR |= (blt_int32u)(0x00000004);
/* configure BUT (GPIOA0) as floating digital input */
/* first reset the configuration */
GPIOA->CRL &= ~(blt_int32u)((blt_int32u)0xf << 0);
/* CNF0[1:0] = %01 and MODE0[1:0] = %00 */
GPIOA->CRL |= (blt_int32u)((blt_int32u)0x4 << 0);
} /*** end of BackDoorInitHook ***/
/************************************************************************************//**
** \brief Checks if a backdoor entry is requested.
** \return BLT_TRUE if the backdoor entry is requested, BLT_FALSE otherwise.
**
****************************************************************************************/
blt_bool BackDoorEntryHook(void)
{
/* button PA0 has a pullup, so will read high by default. enter backdoor only when
* this button is pressed. this is the case when it reads low */
if ((GPIOA->IDR & ((blt_int32u)0x01)) == 0)
{
return BLT_TRUE;
}
return BLT_FALSE;
} /*** end of BackDoorEntryHook ***/
#endif /* BOOT_BACKDOOR_HOOKS_ENABLE > 0 */
Well I read the manual and got backdoor working using button matrix.
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
Ans:
yes it is that hard for me anyways but got it done
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- FDR
- Offline
PB has the one for the DEVO 8 for sure, but he is absent...
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
Please Log in or Create an account to join the conversation.
- rbe2012
- Offline
- So much to do, so little time...
- Posts: 1433
I took a very short look in the code trying to help you understand the way ports are used (and changed). It is obvious that they are controlled by a few registers like GPIOA->CRL, GPIOB->CRH, ..->BRR and ..->BSRR, but I have not found the correct *.h-file where those names are defined.
Usually the registers are organized in bits where bit0 represents the GPIO-line 0 of the corresponding port (GPIOB bit3 = PB3).
Because the loader is constructed for many MCUs it has an abstraction layer what makes it easy to program (because names are equal for every MCU) but without the translation table (usually a MCU-NAME.h-header-file containing a lot of #define-directives) I can not tell you which of the registers GPIOn->XXX is used for what purpose.
If you point me to the header file I could tell you more.
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
Well I somehow managed to read Reference manual while reading few different sites and using programmers calculator. You guys got a number system for everything!!! Just setting pin to function so long winded. Still I can see why it's good thing and being able to move peripheral to another port/pin is exciting, No? And useful to us....
I've got it all going apart from button matrix, so back door can be used and pretty sure I know what I did wrong and how to fix it! So I have working loader which with minor changes will work for all the Tx. There are other things that could make life simpler but hey another day...
Now only thing left for me to learn is using screen. Now I've dropped lucky in that u8glib has Arm version so with a lot of luck could be possible. Well I used that before to help get my OLED work with deviation, so fingers crossed.
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
No screen output Think the best I can manage would be to switch on screen back light and Windows will tell you good to go as well.
Would anyone help me with next tweak. This loader uses 'SREC' and I can use 'OBJCOPY -Osrec devo7e.elf devo7e.srec' would I be able to add this to make file ?
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
Now if i do that all again but while its loading update I hold 'Ent' button and update completes it just to Deviation and screen lights up with USB logo and i can use flash, format load files what not. Then I press 'Ent' to go to main screen and it goes blank. And when I re-power again back to the loader again no valid program.
Well while I was putting this all together I thought why not zip up what I have. Well you could knock me down with a feather It Works!! What changed? well it wasn't my typing but I did compile deviation using sbstnp VM Odd but I'll take it
Maybe this can help towards memory problems for devo7e.
Please Log in or Create an account to join the conversation.
- blackmoon
- Offline
- Posts: 402
If I knew I wouldn't have spent the all weekend searching for a suitable BL
How large is the BL ?
I was under the impression that openblt was like 24kb (but now I see that it's maybe with all the options usb, serial...).
Which files did you modify on the deviation source to make it reserve space for the BL's checksum location .
Was it "\src\libopencm3\lib\cm3\vector.h and vector.c" ?
The .elf file is unencrypted isn't it ?
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
Please Log in or Create an account to join the conversation.
- blackmoon
- Offline
- Posts: 402
feaser.com/openblt/doku.php?id=homepage
It isn't the same as walkera (but who knows, maybe they used this one...)it just a way to convert old transmitters to devention.
I'll be converting a Wk-2602, with one of these boards, they have a stm32F103VET6 so I could load Devo10 (maybe the devo8 with a patch for the 2 pots that the 2602 has) firmware.
dx.com/p/stm32-core103v-cortex-m3-stm32f...lopment-board-150550
dx.com/p/port103v-stm32f103vet6-arm-cort...nt-core-board-148526
dx.com/p/stm32-mcu-arm-cortex-m3-stm32f1...lopment-board-150993
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- blackmoon
- Offline
- Posts: 402
Is STM32 BL open source ?
Yeah I wish, I know
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
STM has a rather unclear license, but the code is (or at least was) available and may be modified without permission.blackmoon wrote: Didn't knew that obviously.
Is STM32 BL open source ?
Yeah I wish, I know
Please Log in or Create an account to join the conversation.
- SadSack
- Topic Author
- Offline
- Posts: 317
Think the code used for USB loader is 8K but can be used via Serial port. can use sd and flash.
I've tried to upload what I've done but 11meg I'm guessing is to big, Ill break it down to smaller chucks..
OpenBLT
Please Log in or Create an account to join the conversation.
- blackmoon
- Offline
- Posts: 402
Did you use the VM to compile the bootloader to ?
Please Log in or Create an account to join the conversation.
- victzh
- Offline
- Posts: 1386
You must have programmed your own hook function, that's the only needed part. It should take much less than 11MB, I'd be surprised if it's 11KB, so you can attach it here.
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- Devo Loader. Now working Fully