Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4-in-1 ESCs #132

Open
davidbitton opened this issue Mar 22, 2016 · 5 comments
Open

4-in-1 ESCs #132

davidbitton opened this issue Mar 22, 2016 · 5 comments

Comments

@davidbitton
Copy link

Could the codebase be adapted to a C8051F363 chip? It runs at 100 MHz and has 5 digital ports. All of the 4-in-1 ESCs that I see are really just 4 ESCs "glued" together. Would be nice to reduce the chip count and have one MCU for all four motors. Is this feasible? Thanks!

@sskaug
Copy link
Collaborator

sskaug commented Mar 22, 2016

Still, at a minimum, I'd say four comparators would be needed.
Not sure about other resources, like memory etc.

@davidbitton
Copy link
Author

I checked and SiLabs does NOT have an MCU with 4 comparators; Atmel does. The three supporting processors are here. The only difference between the three Atmel chips is memory size (as I can see). As for pricing, a single ATmega8-16AU runs just above $4 USD for a single chip whereas the ATmega16M1 in single lots is just under $6 USD. When you start to look at unit costs, one ATmega16M1 sure beats 4 ATmega8-16AU MCUs.

@PEMFCS
Copy link

PEMFCS commented Apr 1, 2016

In a one-MCU-for-one-motor scheme, the comparator is operated in a multiplex way for A, B, C phases. While in a one-MCU-for-four-motors scheme(if exist), the only one comparator should also be operated in a multiplex way for A1, A2, A3, A4, B1, B2, B3, B4, C1, C2, C3, C4 phases, serially, if the MCU is fast enough.

The truth is that i don't have to find out the exact time of zero cross event. only if the frequency is high enough, what i need is the time of check in which the comparator result is changed compared to the previous check. the time of zero cross event could be find out somewhat roughly. think about the differences between analog and digital.

now the problem is, you need an MCU with a 12 ways multiplexer for quad-motors, or 9 ways multiplexer for tri-motors and 6 ways multiplexer for dual-motors.

@davidbitton
Copy link
Author

@nonamerubbish can you be a little more specific so I know what to look for in an MCU? This is from the C8051F363 datasheet.

1.7. 10-Bit Analog to Digital Converter
The C8051F360/1/2/6/7/8/9 devices include an on-chip 10-bit SAR ADC with up to 21 channels for the differential
input multiplexer. With a maximum throughput of 200 ksps, the ADC offers true 10-bit linearity with
an INL and DNL of ±1 LSB. The ADC system includes a configurable analog multiplexer that selects both
positive and negative ADC inputs. Ports1-3 are available as an ADC inputs; additionally, the on-chip Temperature
Sensor output and the power supply voltage (VDD) are available as ADC inputs. User firmware
may shut down the ADC to save power.

Is this what you mean?

@PEMFCS
Copy link

PEMFCS commented Apr 2, 2016

In fact, i just start learning the AVR MCU. i don't know much about C8051. so the method i provide could be possible, but not must be possible.

the zero cross event is checked with Analog Comparator, but not Analog and Digit Convertor, in the BLHeli program for AVR MCU as i know. is it the same for C8051 MCU?(@ sskaug)

saidinesh5 added a commit to saidinesh5/BLHeli that referenced this issue Dec 24, 2020
Thanks to https://github.com/RamonMartins/BLHeli_S-Startup-Tones

music_gs4:
	mov	Temp3, bitdump#58 ;length of tone
	mov Temp4, bitdump#29 ;number of delay loop1 cycles (tone frequency)
	mov Temp5, JazzMaverick#2  ;number of delay loop2 cycles (large step?)
	jmp music

music_as4:
	mov	Temp3, bitdump#58
	mov Temp4, bitdump#29
	mov Temp5, JazzMaverick#2
	jmp music

music_f1:
	mov	Temp3, bitdump#222
 								;length
of tone
	mov Temp4, bitdump#110
	mov Temp5, JazzMaverick#2

;one ms ;frequency of tone 1=500, 2=1000, 3=1500
	jmp music

music_f2:
	mov	Temp3, bitdump#132
 								;length
of tone
	mov Temp4, bitdump#43
	mov Temp5, JazzMaverick#3

;one ms ;frequency of tone 1=500, 2=1000, 3=1500
	jmp music

music_f3:
	mov	Temp3, bitdump#132
 								;length
of tone
	mov Temp4, bitdump#29
	mov Temp5, JazzMaverick#2

;one ms ;frequency of tone 1=500, 2=1000, 3=1500
	jmp music

music_f4:
	mov	Temp3, bitdump#88 ;44
	mov Temp4, bitdump#172
	mov Temp5, JazzMaverick#2
	jmp music

music_g4:
	mov	Temp3, bitdump#98 ;49
	mov Temp4, bitdump#110
	mov Temp5, JazzMaverick#2
	jmp music

music_c:
	mov	Temp3, bitdump#65
	mov Temp4, bitdump#182
	mov Temp5, JazzMaverick#1
	jmp music

music_d2:
	mov	Temp3, bitdump#146 ;73
	mov Temp4, bitdump#140
	mov Temp5, JazzMaverick#1
	jmp music

music_ds:
	mov	Temp3, bitdump#78
	mov Temp4, bitdump#121
	mov Temp5, JazzMaverick#1
	jmp music

music_e:
	mov	Temp3, bitdump#82
	mov Temp4, bitdump#103
	mov Temp5, JazzMaverick#1
	jmp music

music_f:
	mov	Temp3, bitdump#87
	mov Temp4, bitdump#86
	mov Temp5, JazzMaverick#1
	jmp music

music_g:
	mov	Temp3, bitdump#196 ;98
	mov Temp4, bitdump#55
	mov Temp5, JazzMaverick#1

music:
	mov A, Temp5
	push ACC

	BcomFET_on

; BcomFET on
	ApwmFET_on

; ApwmFET on
	mov	A, Beep_Strength
	djnz	ACC, $

	ApwmFET_off

; ApwmFET off
	BcomFET_off

; BcomFET off
	pop ACC
	mov Temp5, A
	mov Temp2, A

; Make copy of Temp5 to work with (Temp2)
	mov A, Temp4
	mov Temp6, A
music_O_loop:

; Outer loop
	mov	Temp1, bitdump#23

; Number of times to repeat inner delay loop
music_M_loop:

; Middle loop
	clr	A
 	djnz	ACC, $

; Inner loop (42.7us - 1024 cycles)
	djnz	Temp1, music_M_loop
	djnz	Temp2, music_O_loop

wait_150us:
	mov		A, bitdump#30

;5us wait
	djnz	ACC, $
	djnz	Temp6, wait_150us
	djnz	Temp3, music
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants