Ok I have a board that has a 40pin dip with sockets Arduino shields,
5v/3.3v 3amp power supply,
second six pin header for programming,
provision to plug a 16 x 2 LCD into the end of the board with a pot for contrast on the board,
provision to set up an external reference for ADC,
provision for TPIC6C595 (High power 74HC595) or 74HC595 & for 74HC165 these provide 8 output ports and 8 input ports using only 4 pins of the AVR Note the TPIC6C595 can drive devices like relays directly
provision for bias resistors on the I2C buss
With this board any of the 40pin dip AVRs can be used but for a web server the MEGA1284 is needed for its ram
some components are surface mounted on the back of the board
TO220 size LM5768 3.3V regulator that uses a 1500 resistor for 5V or a link for 3.3V, SMT inductor & 3A diode
the TPIC6C595 is SO16
the 74HC165 is SO16 these are not to hard to mount
Note the connection to the Arduino 6 pin spi is done via resistors these should be around 100-180 ohms this stops the wiznet shield from interfering with programming the AVR via SPI
The board was done with Kicad attached is a pdf that can be used to print a positive to make it by hand as I did I will attach the Kicad files later
I will make a double sided version later to be commercially made by anyone who wants to
Sorry there is no circuit diagram but its fairly simple to follow
Regards Paul
↧
BASCOM Project Blog : Building a Webserver with a Wiznet W5100 : REPLY
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : NEWTOPIC
Hello,
I have on a Atmega2560 the Uart0 connected to RS485 deveice. It works with baud 38400
Now what i not understand is, on the RX0 pin2 PE.0 i have a 1k resistor in serie with a Led to see the comunication.
If i remove the resistor or the led that is in serie, the comunicatio not works more and the Atmega make reset trough Watchdog
Have anyone know why this happens?
Thanks in advance
Best regards
toto
[b:f9898d8da0][color=red:f9898d8da0](BASCOM-AVR version : 2.0.7.2 , Latest : 2.0.7.7 )[/b:f9898d8da0][/color:f9898d8da0]
↧
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : NEWTOPIC
Hello,
I have on a Atmega2560 the Uart0 connected to RS485 deveice. It works with baud 38400
Now what i not understand is, on the RX0 pin2 PE.0 i have a 1k resistor in serie with a Led to see the comunication.
If i remove the resistor or the led that is in serie, the comunicatio not works more and the Atmega make reset trough Watchdog
Have anyone know why this happens?
Thanks in advance
Best regards
toto
[b:53e4447b93][color=red:53e4447b93](BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.7 )[/b:53e4447b93][/color:53e4447b93]
↧
BASCOM-AVR : data problem : NEWTOPIC
Hello All,
This code will run in your simulater. Please try it and help me understand why it does not work
like I think it should.
The sub RFM24_Configure should step through all the data statments sending config data to my RFM24W.
The first read data is the length of the data set to be sent to the rfm24. Then data set is sent. Then the next read after that is the length of the next set...
It is suppose to read through ALL the data until the length is zero.
The problem is it stops before reaching the end of the data. You will have to run it to see what I'm trying to explain.
I've commented out the hardware parts for the sim but the problem still shows up.
[code:1:368d9e0533]$regfile = "m168def.dat"
$crystal = 8000000
$baud = 38400
$hwstack = 100
$swstack = 100
$framesize = 100
CONFIG SUBMODE = NEW
sub RFM24_Configure()
local b_dat as byte
local b_Length as byte
local b_n as byte
local b_temp as byte
restore CONFIGURATION_COMMANDS
read b_Length
while b_Length > 0
'reset rfm24_Nsel
print
print "L1 ";b_Length
for b_n = 1 to b_Length
read b_dat
'spiout b_dat,1
print "D ";hex(b_dat)
next
'set rfm24_Nsel
'b_temp=Api_WaitforCTS()
read b_Length
print "L2 ";b_Length
wend
print "end config ";b_Length
end sub
rfm24_configure
do
loop
end
CONFIGURATION_COMMANDS:
' Command: RF_POWER_UP
' Description: Command to power-up the device and select the operational mode and functionality.
RF_POWER_UP:
data 7
data &h02, &h01, &h00, &h01, &hC9, &hC3, &h80
' Command: RF_GPIO_PIN_CFG
' Description: Configures the GPIO pins.
RF_GPIO_PIN_CFG:
data 8
data &h13, &h61, &h00, &h60, &h00, &h40, &h00, &h20
' Set properties: RF_GLOBAL_XO_TUNE_1
' Number of properties: 1
' Group ID: &h00
' Start ID: &h00
' Default values: &h40,
' Descriptions:
' GLOBAL_XO_TUNE - Configure the internal capacitor frequency tuning bank for the crystal oscillator.
RF_GLOBAL_XO_TUNE_1:
data 5
data &h11, &h00, &h01, &h00, &h52
' Set properties: RF_INT_CTL_ENABLE_2
' Number of properties: 2
' Group ID: &h01
' Start ID: &h00
' Default values: &h04, &h00,
' Descriptions:
' INT_CTL_ENABLE - This property provides for global enabling of the three interrupt groups (Chip, Modem and Packet Handler)
' in order to generate HW interrupts at the NIRQ pin.
' INT_CTL_PH_ENABLE - Enable individual interrupt sources within the Packet Handler Interrupt Group to generate a HW interrupt
' on the NIRQ output pin.
RF_INT_CTL_ENABLE_2:
data 6
data &h11, &h01, &h02, &h00, &h01, &h30
' Set properties: RF_FRR_CTL_A_MODE_4
' Number of properties: 4
' Group ID: &h02
' Start ID: &h00
' Default values: &h01, &h02, &h09, &h00,
' Descriptions:
' FRR_CTL_A_MODE - Fast Response Register A Configuration.
' FRR_CTL_B_MODE - Fast Response Register B Configuration.
' FRR_CTL_C_MODE - Fast Response Register C Configuration.
' FRR_CTL_D_MODE - Fast Response Register D Configuration.
RF_FRR_CTL_A_MODE_4:
data 8
data &h11, &h02, &h04, &h00, &h00, &h00, &h00, &h00
' Set properties: RF_PREAMBLE_TX_LENGTH_9
' Number of properties: 9
' Group ID: &h10
' Start ID: &h00
' Default values: &h08, &h14, &h00, &h0F, &h21, &h00, &h00, &h00, &h00,
' Descriptions:
' PREAMBLE_TX_LENGTH - Configure length of TX Preamble.
' PREAMBLE_CONFIG_STD_1 - Configuration of reception of a packet with a Standard Preamble pattern.
' PREAMBLE_CONFIG_NSTD - Configuration of transmission/reception of a packet with a Non-Standard Preamble pattern.
' PREAMBLE_CONFIG_STD_2 - Configuration of timeout periods during reception of a packet with Standard Preamble pattern.
' PREAMBLE_CONFIG - General configuration bits for the Preamble field.
' PREAMBLE_PATTERN_31_24 - Configuration of the bit values describing a Non-Standard Preamble pattern.
' PREAMBLE_PATTERN_23_16 - Configuration of the bit values describing a Non-Standard Preamble pattern.
' PREAMBLE_PATTERN_15_8 - Configuration of the bit values describing a Non-Standard Preamble pattern.
' PREAMBLE_PATTERN_7_0 - Configuration of the bit values describing a Non-Standard Preamble pattern.
RF_PREAMBLE_TX_LENGTH_9:
data 13
data &h11, &h10, &h09, &h00, &h08, &h14, &h00, &h0F, &h31, &h00, &h00, &h00, &h00
stop_config:
data 0 'length of zero stops the configuation.
[/code:1:368d9e0533]
[b:368d9e0533][color=red:368d9e0533](BASCOM-AVR version : 2.0.7.7 )[/b:368d9e0533][/color:368d9e0533]
↧
BASCOM-AVR : data problem : REPLY
Hi,
I've not looked at your code too closley but I'm doing something similar for my RFM73 module. Maybe you can make use of the code:-
[code:1:20b327bc24]
Sub Setup_radiomodule()
'Function : Setup radio module
'Author : Ian Dobson
'Inputs : None.
'Outputs : None
'Limitations : The data structure with the data to be written needs to be selected
'Date : 19.1.2014
Do
Read Temp_byte1
If Temp_byte1 = 0 Then
Exit Do
End If
For Temp_byte = 1 To Temp_byte1
Read D_bytes(temp_byte)
Next Temp_byte
If D_bytes(1) = Rx_addr_p0 Then
D_bytes(1) = Address
End If
D_bytes(1) = D_bytes(1) + Write_reg
Call Write_register(temp_byte1)
Loop
End Sub
'--- Data for receiver radio module -------------------------------------------
Rx_structure:
Data 2 , Setup_aw , &B00000001 '3bit address
Data 4 , Rx_addr_p0 , &H01 , &H42 , &H24 'RX adress for pipe0
Data 2 , En_aa , &H01 'Enable auto ACK for pipe0
Data 2 , En_rxaddr , &H01 'Enable RX adress for pipe0
Data 2 , Rf_ch , 99 'Set RF channel
Data 2 , Rx_pw_p0 , 3 'Set RX pload width for pipe0
Data 2 , Rf_setup , &B00000111 'Setup RF-> Output power 5dbm, datarate 1Mbps and LNA gain on
Data 2 , Config_nrf , &B00001011 'Setup CONFIG-> PRX=1(RX_device), PWR_UP=1, CRC 1bytes, Enable CRC
Data 0 'end of data
[/code:1:20b327bc24]
The data structure is Number of Bytes, Register Name, X Bytes of data.
Regards
Ian Dobson
↧
↧
BASCOM-AVR : data problem : REPLY
Thanks Ian,
We are doing about the same thing.
My code stops unexpected after the second data set. The next length in the next data set is 5 but the read returns 0.
I should have commented the lengths in the data. The lengths are the data that is not in hex.
I still don't know what the problem is..
↧
BASCOM-AVR : data problem : REPLY
Hi,
The 4th Byte in your data is 0. Could it be that the code is seeing that and stopping?
As I said I've not looked at your code too much, and I have to leave for work now...
Just try single stepping through the code and see where it stops (start Simulator, set breakpoint at the start of the Setup Routine and use F8 to execute each line of code).
Regards
Ian Dobson
↧
BASCOM-AVR : data problem : REPLY
Progress!
I just removed some of the labels in the data and now the program reads data correctly till it comes to a label then stops again.
Maybe there is something wrong with my labels. To long? I'll keep trying.
↧
BASCOM-AVR : data problem : REPLY
Ian
Thanks again, I have single stepped and it makes no sense.
I think it's a problem for Mark to look at.
If I put in any labels in the data the read statement breaks.
I hope Mark is reading this because it's going to be hard to explain in an email.
↧
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : REPLY
Hello,
What is the pin configuration. Did you use the internal pull-up?
Thomas
↧
BASCOM-AVR : data problem : REPLY
when you put a label into the code the data need to be aligned. otherwise a RESTORE on a label will not work.
For example :
sample 1
abc:
data 1
def:
data 2
sample 2
abc:
data 1
data 2
the second sample will combine the 2 bytes into a word and stores it in the word address of the flash.
the first sample will store the 1 and a zero byte because of the 'def' label. then it stores a 2 and also a zero so the data ends up in 2 words. while in sample 2, the data ends up in 1 word.
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : REPLY
Hello wieczus,
No, not use pullup, only this on start of the code
Config Com1 = 38400 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Open "Com1:" For Binary As #1 'RS485 trough Uart0
Config Serialin = Buffered , Size = 250
Enable Interrupts
Best regards
toto
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : REPLY
Take multimeter in hands. Is the both grounded together properly? Is the supply voltage is the same for each one? If one is 3,3V then interface with resistors is needed. Read Datasheet for second RS485 device.
↧
↧
BASCOM-AVR : data problem : REPLY
Thanks Mark
I'm glad it's not a bug in bascom. A warning by the compiler or in Language Fundamentals would be a good improvement.
Here is my solution for now.
if the last length is an even number add a second read for the next length.
[code:1:12805734d7] while b_Length > 0
b_temp = b_Length mod 2 '<--- b_temp = 0 or 1 for even or odd number.
'reset rfm24_Nsel
print
print "L1 ";b_Length
for b_n = 1 to b_Length
read b_dat
'spiout b_dat,1
print "D ";hex(b_dat)
next
'set rfm24_Nsel
'b_temp=Api_WaitforCTS()
read b_Length
if b_temp=0 then read b_Length '<--- add an extra read needed for even lengths.
print "L2 ";b_Length
wend[/code:1:12805734d7]
↧
BASCOM-AVR : data problem : REPLY
My solution above did not work with my real data.
I added dummy data for word alinement but still no good.
Does anybody have a suggestion for this AVR limitation?
↧
BASCOM-AVR : data problem : REPLY
[quote:34790e889e="albertsm"]when you put a label into the code the data need to be aligned. otherwise a RESTORE on a label will not work.[/quote:34790e889e]
With all due respect :D
I see no reason, why there should be only access to aligned bytes.
The compiler knows, whether an even or odd flash address is accessed. The Restore command accepts no variable, so everything is set and can be done at compile time.
In case a Data-label points to an odd byte address, the Z-pointer can be set to the basic word address, then a dummy LPM read is issued and voila, c'est fait.
I'm a friend of large data segments, which can be either read sequentially from start till end, or read segmented by labels.
Padding bytes are therefore unnecessary and annoying.
↧
BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : REPLY
Show us some more code, the loop where the wd resets.
What serial statements are you using in this loop?
Do you use the Config print = xx to switch Rs485 rx/tx mode?
↧
↧
BASCOM-AVR : data problem : REPLY
i did not say a label can not be an uneven word address. i said the address is always a word. which means it uses 2 bytes. this because all instructions use words (2 bytes). Some uses even 2 words. I know you know all this stuff but for completeness :
address 0:
byte 1 , byte 2 ; an instruction will use at least 2 bytes
address 1:
byte 3, byte 4
address 2:
byte 5, byte 6
when you do a jump/call you can only do so to a word address. you can not jump into the middle of it. that is why a label always is aligned to a word.
↧
BASCOM-AVR : data problem : REPLY
Sure, word alignement is important within the code segment, but this is all about a data segment. Also sure, data labels do not look different to code labels.
A jump to an uneven data label would thus fail, but I can't think of many uses, why one would like jump to or execute data. If a data segment is placed within code, padding needs to be done, but only at the end of the data segment, so following code is aligned again.
Still I do not see the need of word aligned data labels within a data segment, other tan the ease and consistency to treat all labels the same, no matter if code or data segment.
↧
BASCOM-AVR : Xmega USART in SPI MODE : NEWTOPIC
Hi everyone!
Please Help with Example settings COM2 (PORTC.7 PORTC.6) in MASTER SPI MODE.
And an example of commands PRINT and INPUT.
Not found examples this mode. :(
Thanks,
Ruslan.
[b:76e194b44c][color=red:76e194b44c](BASCOM-AVR version : 2.0.7.7 )[/b:76e194b44c][/color:76e194b44c]
↧